简体   繁体   English

在php中填充下拉菜单时出错

[英]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. 不知道答案可能多么la脚,但是ima newbie似乎在用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) 我收到的Parse error: syntax error, unexpected 'VALUE' (T_STRING)Parse error: syntax error, unexpected 'VALUE' (T_STRING)

resolved.. knew it had to be been some lame problem. 解决了..知道一定是一些la脚的问题。 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
}
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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