Jump to content

500 Server Error - mysqli associative array


atticus

Recommended Posts

I know that I am missing something simple, probably in my syntax. But I am getting a 500 server error instead of a PHP error. Not sure why

 

Here is the total associative array query:

 

$query = "SELECT address, zip, square_footage FROM person WHERE person_id = $id";

if ($result = $mysqli->query($query)) {

    /* fetch associative array */
    while ($row = $result->fetch_assoc()) {
     $message .= '\n <strong>Square Footage: </strong>' .$row["square_footage"]; 
 $message .= '\n <strong>Address </strong>' .$row["address"]; 
 $message .= '\n <strong>Zip </strong>' .$row["zip"]);
    }

    /* free result set */
    $result->free();
}

 

If I remove the following three lines, I no longer get an error:

 

$message .= '\n <strong>Square Footage: </strong>' .$row["square_footage"]; 
$message .= '\n <strong>Address </strong>' .$row["address"]; 
$message .= '\n <strong>Zip </strong>' .$row["zip"]);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.