mysql_fetch_array问题代码未处理

时间:2010-10-14 09:36:13

标签: php mysql

每次打开下面的代码时,我的页面都会停止加载...它看起来是正确的,表格和字段是正确的。

<select name="common" style="width: 136px;">    
<?php
    $group1 = mysql_fetch_array(mysql_query("SELECT country FROM lang_list WHERE grouping = '1' ORDER BY p_order"));
    while($row = $group1){
        echo "<option value=\"$group1\">$group1</option>\n";
    }
?>
</select>

2 个答案:

答案 0 :(得分:2)

<?php
    $group1 = mysql_query("SELECT country FROM lang_list WHERE grouping = '1' ORDER BY p_order");
    while($row = mysql_fetch_array($group1)){
        echo "<option value=\"$row[country]\">$row[country]</option>\n";
    }
?>

答案 1 :(得分:1)

试试这个:

<select name="common" style="width: 136px;">     
<?php 
        $recordset = mysql_query("SELECT country FROM lang_list WHERE grouping = '1' ORDER BY p_order") or die("Error found: " . mysql_error());
    while($row = mysql_fetch_array($recordset)){ 
        echo "<option value=\"".$row['country']."\">".$row['country']."</option>\n"; 
    } 
?> 
</select>