希望有人能帮我。我所要做的就是在数据库中插入一条记录,但我一直收到消息。
您的SQL语法出现了错误;请检查与MySQL服务器版本对应的手册,以便在我的页面第1行使用“order”(pid、uid、projecttitle、username、value、odate)值(、“”、“”、“6-2”)。
下面是代码的主要部分。能帮我的人我会很感激的。
<?
extract($_REQUEST);
//print_r($_REQUEST);
//query fetch user & project info
//$queryorder="select * from project p where p.pid='".$id."'";
$queryorder="select * from users u,project p where p.pid='".$id."' and u.uid='".$_SESSION['key']."'";
$resultorder=executequery($queryorder,$link);
$rowo=mysql_fetch_assoc($resultorder);
//print_r($rowo);
//get today date
$createddate=date("n-j-Y");
//order
$order="insert into order (pid,uid,projecttitle,username,amount,odate)
values (".$rowo['pid'].",".$rowo['uid'].",'".$rowo['projectname']."','".$rowo['username']."',".$rowo['price'].",'".$createddate."')";
mysql_query($order) or die(mysql_error());
//end of insert order query
?>
<? //headtag.php conatain all javascript & css files
include('headtag.php');
?>
<body>
发布于 2011-06-28 15:49:42
ORDER
是mysql关键字。试试这个:
INSERT INTO `order` ...
发布于 2011-06-28 15:51:17
order
是关键字。你得用后背躲避它。
insert into `order` (pid,uid,projecttitle,username,amount,odate)...
发布于 2011-06-28 15:49:22
必须为每一列提供一个值。
(,,'','',,'6-2'
很明显,你没有pid,uid和value的值。
https://stackoverflow.com/questions/6509193
复制相似问题