PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
manRay
Forum Commoner
Posts: 78 Joined: Mon Feb 09, 2009 1:57 pm
Post
by manRay » Tue Mar 09, 2010 11:31 pm
I have know idea why this is not working. Every thing is correct, in terms of connecting to the DB.
Code: Select all
mysql_query ("INSERT INTO friend_info (FRIEND_ID,FULL_NAME,BIRTH_DATE,FAV_COLOR) VALUES (''1',bill gates','10-25-1967','green')");
Can anybody see why?
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Tue Mar 09, 2010 11:36 pm
Weird quoting you got going on there.
kevinwinters
Forum Newbie
Posts: 20 Joined: Wed Jan 06, 2010 8:31 pm
Post
by kevinwinters » Tue Mar 09, 2010 11:38 pm
the 2 single quotes in front of 1 and looks like bill gates is missing single quote in front of his name.
those 2 items look odd to me....
manRay
Forum Commoner
Posts: 78 Joined: Mon Feb 09, 2009 1:57 pm
Post
by manRay » Wed Mar 10, 2010 8:43 am
This doesn't work either
Code: Select all
mysql_query(" INSERT INTO friend_info SET FRIEND_ID ='7', FULL_NAME = 'bill gates', BIRTH_DATE = '10-25-1967', FAV_COLOR = 'green' ");
kevinwinters
Forum Newbie
Posts: 20 Joined: Wed Jan 06, 2010 8:31 pm
Post
by kevinwinters » Wed Mar 10, 2010 8:52 am
What is the error? Is your friend_id field formatted as a number or text?
manRay
Forum Commoner
Posts: 78 Joined: Mon Feb 09, 2009 1:57 pm
Post
by manRay » Wed Mar 10, 2010 8:53 am
Nothing is getting inserted into the DB. I removed friend_ID from the query because it is a primary id that gets auto incremented.
mikosiko
Forum Regular
Posts: 757 Joined: Wed Jan 13, 2010 7:22 pm
Post
by mikosiko » Wed Mar 10, 2010 4:56 pm
manRay wrote: I have know idea why this is not working. Every thing is correct, in terms of connecting to the DB.
Code: Select all
mysql_query ("INSERT INTO friend_info (FRIEND_ID,FULL_NAME,BIRTH_DATE,FAV_COLOR) VALUES (''1',bill gates','10-25-1967','green')");
Can anybody see why?
you got answers to it in the first 2 posts.... don't know why you changed your syntaxes to INSERT... SET (which is incomplete).... your error is your
" usage...
try this.. (assuming FRIEND_ID is an auto-generated key)
Code: Select all
mysql_query("INSERT INTO friend_info (FRIEND_ID,FULL_NAME,BIRTH_DATE,FAV_COLOR) VALUES (NULL,'bill gates','10-25-1967','green')");