For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > March 2005 > Re: Insert not working









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Insert not working
J.O. Aho

2005-03-01, 8:57 pm

Mike P wrote:
> I have the following code
> $gb_q ="Insert into guestbook
> ('Name','E_Mail','Seen_Perform','Perform
_Where','Find_Site','Where_From','Co
> mments')Values('$Name','$E_Mail','$Seen_
Perform','$Perform_Where','$Find_Sit
> e','$Where_From','$Comments')";
> echo "$gb_q";
> $result = mysql_query($gb_q);
>
> All of the variables come back from the form with no problems.
> I also have an auto_increment field that i am leaving out of the query.Its
> the first field(primary)
> This is not working.
> Any help would be appreciated


Do you get any error messages?
Add a space between ')' and 'Values'.

Have you selected the right database, so you aren't trying to insert into a
table that is missing?

If you have use unique for one of the columns and you are trying to insert a
new row with an already inserted row, then it will too fail.


Added alt.php.sql to the newsgroups as this is an sql question.

//Aho
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com