简体   繁体   中英

error in populating a drop down menu in php

Here is my function that should populate a drop down list dynamically. But its not working and i cant seem to find out why. Don't know how lame the answer might be but ima newbie and seem to be struggling a lot with PHP.

Thanks in advance.

$mydata = mysql_query("SELECT * FROM scholarship_details);

while($record=mysql_fetch_array($mydata)){
echo "<OPTION VALUE=".$record['s_name'].">".$record['s_name']."</OPTION>";
} ?>

error im getting is Parse error: syntax error, unexpected 'VALUE' (T_STRING)

resolved.. knew it had to be been some lame problem. thanks guys

在此处使用漏掉的双引号。

$mydata = mysql_query("SELECT * FROM scholarship_details");

Here's the modified code.

<?php
$mydata = mysql_query("SELECT * FROM scholarship_details");//Quotes not properly closed

while($record=mysql_fetch_array($mydata)){
echo "<OPTION VALUE=".$record['s_name'].">".$record['s_name']."</OPTION>";//Quotes not properly closed
}
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM