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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.