Jump to content

[SOLVED] Please help!!! I've tried everything


ask21900

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/61315-solved-please-help-ive-tried-everything/
Share on other sites

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' );";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.