Jump to content

PHP output Html Mess up


Danny620

Recommended Posts

<?php

    require('mysqli_connect.php');

 

// Query the database:

$q = "SELECT * FROM album";

$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));

 

if (@mysqli_num_rows($r) == 1) { // A match was made.

 

echo '<select name="albumid" id="albumid">';

echo '<option value="1" selected="selected">Tribal</option>';

 

while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {

echo "<br /><option value="$row['albumid']">$row['name']</option>";

}

 

    '</select>';

 

}

?>

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xampp\htdocs\upload\upload_image.php on line 147

Link to comment
https://forums.phpfreaks.com/topic/205415-php-output-html-mess-up/
Share on other sites

Which line is 147?

 

Looking at you code, it's probably

<?php
echo "<br /><option value="$row['albumid']">$row['name']</option>";
?>

where you're missing some concatenation operators:

<?php
echo "<br /><option value=" . $row['albumid'] . ">$row['name']</option>";
?>

 

In the future, when you post code to this forum, please put your code between


tags.

 

Ken

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.