0

Trying to connect to a created database thats on a server and display its contents when i attempt to run it the page displays an error that states HTTP 500 error, The site may be under maintenance or could have a programming error.

<?php
ini_set("display_errors",1);
error_reporting(E_ALL);

these have values, just hiding them
when i run the code through a php code checker it has a problem with the '{' on the line bellow

$servername = "servername";
$username = "username";
$password = "password";
$dbname = "dbname";

// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$result = mysql_query("SELECT * FROM Pictures ");
$conn->close();
?>

The HTML used to display the database

<html>

 <table border="2" style= "background-color: #84ed86; color: #761a9b; margin: 0 auto;" >
  <thead>
    <tr>
      <th>id</th>
      <th>Name</th>
      <th>image</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
  <?php
  while( $row1 = mysqli_fetch_assoc( $result ) ){
    foreach ($row1 as $row){
 ?>
    <tr>
      <td><?php $row['id'] ?></td>
      <td><?php $row['hname'] ?></td>
      <td><?php $row['himage'] ?></td>
      <td><?php $row['hdesc'] ?></td> 
    </tr>
 <?php
    }
  }
  ?>
  </tbody>
</table>
 <?php mysql_close($connector); ?>
</body>


 </html>
Qirel
  • 25,449
  • 7
  • 45
  • 62

0 Answers0