从数据库购物车中选择时出现mysql语法错误

时间:2017-05-27 13:58:23

标签: php mysql sql syntax

我的语法错误,无法找到它。

if(isset($_SESSION['SESS_LOGGEDIN']))
{
    $custsql = "SELECT id, status from orders WHERE customer_id = ". 
    $_SESSION['SESS_USERID']. " AND status < 2;";
    $custres = mysql_query($custsql)or die(mysql_error());
    $custrow = mysql_fetch_assoc($custres);

    $itemssql = "SELECT products.*, orderitems.*, orderitems.id AS itemid FROM 
    products, orderitems WHERE orderitems.product_id =products.id AND order_id = " . $custrow['id'];
    $itemsres = mysql_query($itemssql)or die(mysql_error());;
    $itemnumrows = mysql_num_rows($itemsres);
}

我在$ itemssql上收到错误。

0 个答案:

没有答案