Results 1 to 8 of 8

Thread: insert into db - resolved

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Newcastle
    Posts
    260

    insert into db - resolved

    Hi Guys.
    im trying to insert a line into mysql with the follong code
    PHP Code:
    mysql_connect("localhost","root","InsertYourPasswordHere");
    mysql_select_db ("mywakeupcall");
    $query "INSERT INTO database(fname,lname,alarm,phone) VALUES('".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['atime']."','".$_POST['telephone']."')"

    if (! 
    mysql_query($query))
        die (
    'Query Failed: ' mysql_error());

    echo 
    'Item Entered.'
    however the error msg that comes back is

    Query Failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'database(fname,lname,alarm,phone) VALUES('samantha','murray','1

    andI cant find out whatthe problem is. fname and lname is text and the alarm and phone is numbers.

    any help would be great thanks

    chrisio
    Last edited by Chrisio; Jun 9th, 2004 at 09:11 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width