MySQL Forums
Forum List  »  PHP

Error when selecting MYSQL data to appear in dropdown box
Posted by: R M
Date: March 01, 2006 10:18AM

Dear All,

I am trying to get 2 pieces of data (student id and a name seperated by a comma) to appear in a drop down box. However I keep getting the same error on the first echo statement:

$sql = "SELECT SK_ID, name FROM student";
$result = mysql_query($sql, $conn);
if(mysql_num_rows($result)) {
while($row = mysql_fetch_assoc($result)) {
echo("<option value=\"$row['SK_ID']\">$row['SK_ID'] , $row['name']</option>");
}
} else {
echo("<option value=\"\">No students created yet</option>");

ERROR: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\WAMP5\www\Web_Dev\FYP\createproject.php on line 61

Any help appreciated, Rich



Edited 3 time(s). Last edit at 03/02/2006 08:26AM by R M.

Options: ReplyQuote


Subject
Written By
Posted
Error when selecting MYSQL data to appear in dropdown box
R M
March 01, 2006 10:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.