select4:34
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM categori WHERE auto_id = 34' at line 1代码如下:
$select4 = checkVar($_REQUEST["select4"]);
echo "select4:".$select4."<br>";
$str_sql_category_count1 = "SELECT COUNT(*) AS totalrows FROM categori WHERE auto_id = ".$select4;
$result_category_count1 = mysql_query($str_sql_category_count1,$connect_db) or die(mysql_error());
$row_category_count1 = mysql_fetch_assoc($result_category_count1);
$totalRows_1 = $row_category_count1['totalrows'];
if ($totalRows_1) {
$str_sql_category1 = "SELECT * FROM categori WHERE auto_id = ".$select4;
$result_category1 = mysql_query($str_sql_category1, $connect_db) or die(mysql_error());
$row_category1 = mysql_fetch_assoc($result_category1);
} else {
$str_option = "category = ".$select4;
}上面出错的SQL语句,在phpmyadmin里运行,可以运行通过....请问哪里错了?
请详细一些.
谢谢~
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM categori WHERE auto_id = 34' at line 1代码如下:
$select4 = checkVar($_REQUEST["select4"]);
echo "select4:".$select4."<br>";
$str_sql_category_count1 = "SELECT COUNT(*) AS totalrows FROM categori WHERE auto_id = ".$select4;
$result_category_count1 = mysql_query($str_sql_category_count1,$connect_db) or die(mysql_error());
$row_category_count1 = mysql_fetch_assoc($result_category_count1);
$totalRows_1 = $row_category_count1['totalrows'];
if ($totalRows_1) {
$str_sql_category1 = "SELECT * FROM categori WHERE auto_id = ".$select4;
$result_category1 = mysql_query($str_sql_category1, $connect_db) or die(mysql_error());
$row_category1 = mysql_fetch_assoc($result_category1);
} else {
$str_option = "category = ".$select4;
}上面出错的SQL语句,在phpmyadmin里运行,可以运行通过....请问哪里错了?
请详细一些.
谢谢~
这么写以后提示:select4:34
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM categori WHERE auto_id = '34'' at line 1
$str_sql_category1 = "SELECT * FROM categori WHERE auto_id = $select4";
执行一下看有错吗?
$row_mn4_category1111 = mysql_fetch_array($result_mn4_category1);
改成变上面的量名以后,就可以了.真是无语了.