Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting record into table. (newbie plz help)

Status
Not open for further replies.

Tread42

MIS
Feb 5, 2002
151
US
I'm new to mysql but can't get why the following code does not work? Please advise if I need to include more code for disection.

$usertable = "suggestion";

$sql= "INSERT INTO $usertable
VALUES ($name, $location, $phone, $support_improve, $suggestion, $benefit)";

mysql_query($sql) or die("query didn't work try again!");

Regards,
Tread42
 
you need quotes


$sql= "INSERT INTO $usertable
VALUES ('$name', '$location', '$phone', '$support_improve', '$suggestion', '$benefit')";

Regards,

Namida
 
Thanks namida.
I did need the quotes. Plus it helped when I contacted my server admin and he informed me he changed the server name from 'www' to another name! It always helps. But even that wouldn't have worked without the quotes.

Regards,
Tread42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top