Menu

Insert isn't ...

2003-03-05
2003-03-05
  • Brett Lathrope

    Brett Lathrope - 2003-03-05

    phpCodeGenie builds the following query string from the form it generated ....

    $query="insert into sports (desc,name,level,gender,onseason) VALUES ('$descField','$nameField','$levelField','$genderField','$onseasonField')";

    The problem is, nothing was getting inserted into the database.  But since there was no die(), it told me everything was ok.

    So I added the die, and now I have this;

    $result = MYSQL_QUERY($query) or die("Invalid query: " . mysql_error());

    And that produces this....

    Invalid query: You have an error in your SQL syntax near 'desc,name,level,gender,onseason) VALUES ('Girls Baseball','Baseball','Varsity','' at line 1

    What the heck?  I see nothing wrong.  Yet I can go in with phpMyAdmin and add records all day long.

    Help!!!!  :)

    Brett

     
    • Nilesh Dosooye

      Nilesh Dosooye - 2003-03-05

      can you echo your query after it builds the query to see waht is being sent to MYSQL_QUERY..
      so please put an echo $query; after it builds it and post that and also post ur table structure for the sports table...

       

Log in to post a comment.