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