#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    10
    Rep Power
    0
    Hi again!



    Im currently having a problem here and i hope you can help me with it.

    ADDRESS (e.g): http://somewhere.com/addtoguestbook.php?userid=someguy

    SCRIPT:
    $result = mysql_query("INSERT INTO $userid (name,email,comments) VALUES ('$name','$email','$comments')");

    As you can see, im trying to make a guestbook program. Well, no matter what I try, the thing don't work; won't INSERT.

    I've tried...

    $query = "INSERT INTO ",$userid," blah blah";
    $result = mysql_query($query);

    AND

    $query = "INSERT INTO $userid blah blah";
    $result = mysql_query($query);

    But nothing seems to work.

    What should I do?

    Thanks in advance...
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,640
    Rep Power
    4476
    Right after your mysql_query() command, put the following command:

    echo mysql_error();

    That will show you the error that mysql send back and will probably be very helpful.

    Are you sure that $userid is being set? You're SQL syntax looks correct.

    ---John Holmes...

Similar Threads

  1. Can anyone help with mysql query and results?
    By msmith29063 in forum MySQL Help
    Replies: 3
    Last Post: February 8th, 2004, 03:43 AM
  2. MySQL Update Query
    By Laney in forum PHP Development
    Replies: 1
    Last Post: February 7th, 2004, 04:45 PM
  3. Return a single variable from query
    By dbr1066 in forum PHP Development
    Replies: 4
    Last Post: February 2nd, 2004, 01:42 PM
  4. MySQL Select query
    By MrTee1 in forum MySQL Help
    Replies: 0
    Last Post: January 30th, 2004, 11:16 AM
  5. Replies: 8
    Last Post: January 29th, 2004, 11:45 AM

IMN logo majestic logo threadwatch logo seochat tools logo