我在.php页面上遇到语法错误

时间:2015-03-18 11:11:25

标签: phpmyadmin dreamweaver

我在其中一个.php页面上出现语法错误。我在mysql中进行了查询并粘贴在我的.php页面中。当我尝试打开页面时,它给我一个语法错误。 “来自trolly.idbook = book.idbook上的trolly内部联接书籍附近的语法错误,其中trolly.purchase'àlaligne 1”

mysql_select_db($database_databaseConnection, $databaseConnection);
$query_BookPurchase = sprintf("Select book.name, book.price, From trolly inner join book on trolly.idbook = book.idbook where trolly.purchaseok = %s and trolly.id = %s", GetSQLValueString($varTrolly_BookPurchase, "int"),GetSQLValueString($varUser_BookPurchase, "int"));
$BookPurchase = mysql_query($query_BookPurchase, $databaseConnection) or die(mysql_error());
$row_BookPurchase = mysql_fetch_assoc($BookPurchase);
$totalRows_BookPurchase = mysql_num_rows($BookPurchase);
?>

2 个答案:

答案 0 :(得分:0)

book.price之后有逗号。删除它。

Select
   book.name,
   book.price

From
   trolly 
inner join
   book 
      on trolly.idbook = book.idbook 
where
   trolly.purchaseok = %s 
   and trolly.id = %s

答案 1 :(得分:0)

在书籍.price之后删除逗号,并用

替换查询
Select book.name, book.price From trolly inner join book on trolly.idbook = book.idbook where trolly.purchaseok = %s and trolly.id = %s", GetSQLValueString($varTrolly_BookPurchase, "int"),GetSQLValueString($varUser_BookPurchase, "int"))