Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm stumped - Adding new records! 4

Status
Not open for further replies.

d0nny

IS-IT--Management
Dec 18, 2005
278
GB
I've been mulling over this for about a week now and I really cannot see how this is failing.

I have quite a simple database which I can list the records of. What I am attempting to do now is to add new records to the table. I've done this before and I'm really just reusing the code from previous installations, but this just doesn't want to play ball.

I have a form for inputting new data which I then POST to a new script to save into the table.

So the start of the ADD script sets the POST variables sent from my form. Then I add the SQL INSERT statement using these variables (or some of them) to insert into the table. The problem is I constantly get this error:

Code:
Database ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc) VALUES ( , 1, testing)' at line 1

My INSERT statement looks like this:
Code:
$sql = "INSERT INTO po (supplier_id,createdby_id,desc) VALUES ( $s_id, 1, $desc)";

Any ideas?
Let me know what other info you might require. I will be very pleased if someone can put their finger on this!
 
Pete - i never knew you could use single quotes. you sure? i'll try later.
 
I think I had a similar issue recently and I think I used single quotes. Not certain though. It may have been the GUI client I was using translating them to backticks too.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top