1

I have a problem, i try to update a mysql database with my php script but i become the message:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mod = 3, drehtage = 4, schnitttage = 5, dreh = 0, schnitt = 0, off = 0, leiter =' at line 1

i hope you can help me, here is my code to update the database (i just edit the user + pass ;) )

    $con = mysql_connect('localhost', 'user', 'pass');
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    mysql_select_db("kup_projekte", $con);

    $aendern = "UPDATE drehs SET name = '".$t1."', drehdatum = '".$t2."', schnittdatum = '".$t3."', kamera = '".$t4."', assi = '".$t5."', mod = '".$t6."', drehtage = '".$t7."', schnitttage = '".$t8."', dreh = '".$t9."', schnitt = '".$t10."', off = '".$t11."', leiter = '".$t12."' Where id = '".$id."'";

    $update=mysql_query($aendern);
    mysql_close($con);

// EDIT //

the variables $t1 - $t12 are filled and comes correctly.

1 Answer 1

4

mod is a mysql reserved word. If you want to use it as a column name, you must enclose it in backticks (`) in your SQL queries

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.