0

Do you see something wrong in this insertion??

It does not work for me..

$insSubm = "INSERT INTO cR_Submissions memberID ='".$memberID."', RefNumb='".$RefNumb."', title ='".$title."', 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

1
  • What's the mysql_error() returning? Also note you are using the alternate INSERT syntax, which may not be supported in your version. Commented Jun 4, 2011 at 15:09

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Query should be something like...

$insSubm = "
  INSERT INTO `cR_Submissions` (`memberID`, ...)
  VALUES ('" . $memberID . "', ... )";

Comments

0

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());

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.