ask21900 Posted July 23, 2007 Share Posted July 23, 2007 mysql Ver 12.22 Distrib 4.0.16 dbConnect(); $sql = 'INSERT INTO `Client`( `Client_FName` , `Client_LName` , `Client_CName` , `Client_Street` , `Client_City` , `Client_State` , `Client_Country` , `Client_Zip` , `Client_PhoneCountry` , `Client_PhoneArea` , `Client_PhonePrefix` , `Client_PhoneNum` , `Client_Email` , `Client_StartDate` , `Client_BillDate` , `Client_CurrentQuota` , `Client_CurrentPricePerGig` , `Client_SalespersonID` ) VALUES ( 'Client_FName', 'Client_LName', 'Client_CName', 'Client_Street', 'Client_City', 'St', 'USA', 'Client_Zip', '1', '213', '555', '1212', 'Client_Email', NOW( ) , '3', '5', '2.00', '1' );'; dbClose(); echo "Client Successfully Added!"; Ok. Here's my problem. The DB connects, runs the query, closes the DB and prints the success msg, all without any errors. The server shows that the query was made. Sounds great right? The problem is that the database never updates. No data is in the DB whatsoever. I have tried every possible variation of the code that I can think of, and receive the same results. I have tried it with my original variables, as well as "hard-coding" the date (as above), and still nothing. BTW: The code sample above is not mine, it is the code that was put out by phpMyAdmin. Can anyone tell me anything about this, or what might be happening? Thanx. Quote Link to comment Share on other sites More sharing options...
btherl Posted July 23, 2007 Share Posted July 23, 2007 I don't see any call to run the query. I would expect to see something like dbExec($sql); Quote Link to comment Share on other sites More sharing options...
ask21900 Posted July 23, 2007 Author Share Posted July 23, 2007 Yeah... My original code had that... Must've got lost in the cut and paste. Same results. Quote Link to comment Share on other sites More sharing options...
JayBachatero Posted July 23, 2007 Share Posted July 23, 2007 You have a parse error in your code. If you are going to use single quotes you must escape them inside the string. eg. echo 'It\'s hot outside.'; Or else you get a parse error. Same goes when using double quotes. Change the opening and closing quotes to double quotes. <?php $sql = ' INSERT INTO `Client`( `Client_FName` , `Client_LName` , `Client_CName` , `Client_Street` , `Client_City` , `Client_State` , `Client_Country` , `Client_Zip` , `Client_PhoneCountry` , `Client_PhoneArea` , `Client_PhonePrefix` , `Client_PhoneNum` , `Client_Email` , `Client_StartDate` , `Client_BillDate` , `Client_CurrentQuota` , `Client_CurrentPricePerGig` , `Client_SalespersonID` ) VALUES ( 'Client_FName', 'Client_LName', 'Client_CName', 'Client_Street', 'Client_City', 'St', 'USA', 'Client_Zip', '1', '213', '555', '1212', 'Client_Email', NOW( ) , '3', '5', '2.00', '1' );'; ?> <?php $sql = " INSERT INTO `Client`( `Client_FName` , `Client_LName` , `Client_CName` , `Client_Street` , `Client_City` , `Client_State` , `Client_Country` , `Client_Zip` , `Client_PhoneCountry` , `Client_PhoneArea` , `Client_PhonePrefix` , `Client_PhoneNum` , `Client_Email` , `Client_StartDate` , `Client_BillDate` , `Client_CurrentQuota` , `Client_CurrentPricePerGig` , `Client_SalespersonID` ) VALUES ( 'Client_FName', 'Client_LName', 'Client_CName', 'Client_Street', 'Client_City', 'St', 'USA', 'Client_Zip', '1', '213', '555', '1212', 'Client_Email', NOW( ) , '3', '5', '2.00', '1' );"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.