Danny620 Posted June 21, 2010 Share Posted June 21, 2010 <?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 More sharing options...
kenrbnsn Posted June 21, 2010 Share Posted June 21, 2010 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 Link to comment https://forums.phpfreaks.com/topic/205415-php-output-html-mess-up/#findComment-1074989 Share on other sites More sharing options...
Danny620 Posted June 21, 2010 Author Share Posted June 21, 2010 yes thats the line but i tryed replacing it with yours and all i got was Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING 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/#findComment-1074992 Share on other sites More sharing options...
kenrbnsn Posted June 21, 2010 Share Posted June 21, 2010 Sorry, I didn't fix the other problem, try: <?php echo "<br /><option value=" . $row['albumid'] . ">" . $row['name'] . "</option>"; ?> or <?php echo "<br /><option value=" . $row['albumid'] . ">{$row['name']}</option>"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/205415-php-output-html-mess-up/#findComment-1074994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.