php mySQL insertion issue
Do you see something wrong in this insertion??
It does not work for me..
$insSubm = "INSERT INTO cR_Submissions memberID ='".$memberID."', RefNumb='".$RefNumb."', title ='".$tit开发者_如何学Cle."', CopyRightNumb='".$copyRightNumbWork."', type='".$natureTypeWork."', OtherTitle='".$alternateTitleWork."', OwnershipTransfer='".$textareaPrior."', Status ='".$status."', DateWhen='".$todaydate."', Time='".$NowisTime."'";
$resultinsSubm=mysql_query($insSubm) or die("Error insert Submissions: ".mysql_error());
Am I blind?
Please help
Thanks
That's invalid SQL syntax. The SQL syntax is:
INSERT INTO table (field1, field2, ..., fieldN) VALUES (val1, val2, ..., valN)
An alternative MySQL syntax for this is:
INSERT INTO table SET field1 = val1, field2 = val2, ..., fieldN = valN
You're missing the SET
keyword. Check out the INSERT
Syntax documentation for more about this.
Query should be something like...
$insSubm = "
INSERT INTO `cR_Submissions` (`memberID`, ...)
VALUES ('" . $memberID . "', ... )";
change your code with the following code:
$insSubm = "INSERT INTO cR_Submissions (memberID, RefNumb, title, CopyRightNumb, type, OtherTitle, OwnershipTransfer, Status, DateWhen, Time)
VALUES ('$memberID', '$RefNumb', '$title', '$copyRightNumbWork', '$natureTypeWork', '$alternateTitleWork', '$textareaPrior', '$status', '$todaydate', '$NowisTime');";
$resultinsSubm = mysql_query($insSubm) or die("Error insert Submissions: ".mysql_error());
精彩评论