Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004

    Unanswered: Cant INSERT more than 2 fields at once

    I have a strange problem inserting data to my database.
    The script below works perfectly

    printf ("Name =%s<br>",$name);
    printf ("Style =%s<br>",$style);
    printf ("Address=%s<br>",$address);

    $sql = "INSERT INTO xxx (name,style) VALUES ('$name','$style')";
    mysql_query ($sql,$db);

    As soon as I change the query line to the following nothing works !!

    $sql = "INSERT INTO xxx (name,style,address) VALUES ('$name','$style','$address')";

    $Address does contain valid data, I have tested that by printing it at the start of the script.
    This is even the exact SQL script which MySQL Admin generates when I do it manually and that DOES work.

    It seems to be limiting me to inserting only two fields at a time, if I submit $name & $address it works, add $style to the query and nothing again !!

    Can anyone please help !!
    This is driving me nuts !


  2. #2
    Join Date
    Mar 2004
    Do you get an error message or do the fields not get updated when you try using three of them? From your code I see no reason that it shouldn't work.

  3. #3
    Join Date
    Jan 2004
    No error message at all.
    The database just doesnt update.
    If I do it manually wth three fields from MyphpAdmin it does update.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts