用变量做SQL查询语句中的where条件时出现的错误 10
$sql_s_name="SELTCTs_nameFROMorderWHERE'$val_s_num'";$res_s_name=mysql_query($sql_s_n...
$sql_s_name = "SELTCT s_name FROM order WHERE '$val_s_num'";
$res_s_name = mysql_query($sql_s_name,$con);
$arr_s_name = array();
while ($row_s_name = mysql_fetch_assoc($res_s_name)){
$arr_s_name[] = $row_s_name;
}
foreach ($arr_s_name as $values_s_name){
foreach ($values_s_name as $val_s_name){
echo '<td>'.$val_s_name.'</td>';
}
}
while ($row_s_name = mysql_fetch_assoc($res_s_name))一直提示这条错误,求大神指点
不好意思,查到一个原因了是where没有加条件,已经加上了:
$sql_s_name = "SELTCT s_name FROM order WHERE s_num = '$val_s_num'";
但加上条件了还是提示相同的错误
提示的错误信息为:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in 展开
$res_s_name = mysql_query($sql_s_name,$con);
$arr_s_name = array();
while ($row_s_name = mysql_fetch_assoc($res_s_name)){
$arr_s_name[] = $row_s_name;
}
foreach ($arr_s_name as $values_s_name){
foreach ($values_s_name as $val_s_name){
echo '<td>'.$val_s_name.'</td>';
}
}
while ($row_s_name = mysql_fetch_assoc($res_s_name))一直提示这条错误,求大神指点
不好意思,查到一个原因了是where没有加条件,已经加上了:
$sql_s_name = "SELTCT s_name FROM order WHERE s_num = '$val_s_num'";
但加上条件了还是提示相同的错误
提示的错误信息为:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询