Request:

$query= "INSERT INTO girls_top_month (ID, FROM, TO) VALUES ('".$_REQUEST['id']."', '".date('dmy')."', '".date('dmy')."')"; $result = mysql_query($query) or die(mysql_error()); 

Answer:

You have an error in your SQL syntax; check the syntax for the right syntax to use it’s near the FROM, TO)

Where could I be sealed?

    2 answers 2

    FROM is a SQL construct. Probably need to do like this

      girls_top_month (`ID`, `FROM`, `TO`) 
    • @Damir; To format a code, select it with the mouse and press the {} button of the editor. - Sleeping Owl
    • quite right! TS, be sure to frame and field names are also in quotes to avoid such problems in the future. - thunder
    • TO way is also a SQL command;) - thunder
    • Did not help, You have an error in your SQL syntax; check the syntax for the use of the syntax to use the "ID, FROM, TO") line 1 - Tchort
    • Thanks for the help with formatting the code :) - papagaj

    Try this:

     $itDate = date('dmy'); $reqID = $_REQUEST['id']; $query= "INSERT INTO girls_top_month (ID, FROM, TO) VALUES ('$reqID', '$itDate','$itDate')";