Something wrong with this?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • samui
    New Member
    • Sep 2006
    • 8

    Something wrong with this?

    Okay, so I'm trying to send new rows of data to my table on MySQL. I'm pretty sure I have the syntax right but when I go to execute it, it gives me the "or die" message.

    Can someone correct this bit of code if it's wrong please?

    [php]
    /* send the data to table */

    $query = "INSERT INTO EWT (Bldg,Room,ST,C ageCD,PartNum,S erialNum,VndID, CompId,Model,RO S,Description,S canned,Section)
    VALUES ('$bldg','$room ','$st','$cagec d','$partnum',' $serialnum','$v ndid','$compid' ,'$model','$ros ','$desc','$roo m','$scanned',' $section')";
    $result = mysql_query($qu ery)
    or die ("Couldn't execute query.");
    [/php]
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You are one colum specification short, i.e. you have $room twice within the VALUES(). It would be better to specify the die() with the mysql error concatenated, that would show the error.
    [PHP]die("message " . mysql_error()); [/PHP]

    Ronald :cool:

    Comment

    • samui
      New Member
      • Sep 2006
      • 8

      #3
      Yea I don't know what happened in the Copy & paste, but I assure you the columns are correct on the page.

      I'll change the error message too to see what shows up.

      Also, I checked the user privelages for inserting and altering the table and everything is fine, don't know... :(

      Comment

      • samui
        New Member
        • Sep 2006
        • 8

        #4
        nvm.... apparantly I did put an extra column in the values, lol....

        thx for making me look over it again. Everything works fine now. :D

        Comment

        Working...