Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 04-23-2007, 09:54 AM PHP and MySQL error
SpottyDog's Avatar
Skilled Talker

Posts: 82
Trades: 0
hey guys. would appreiciate some help on this....
I get the error
Code:
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, price) VALUES ('car', 'dfgdf', 'gdfgd', '45', 'Petrol', 'dfgdfg', '4545')' at line 1
Here is the code from the lines it is on about

PHP Code:
mysql_select_db('efesales_vehicles');

$type $_POST['type'];
$make $_POST['make'];
$model $_POST['model'];
$enginesize $_POST['esize'];
$fuel $_POST['fuel'];
$desc $_POST['desc'];
$price $_POST['price'];

$query "INSERT INTO vehicles (type, make, model, esize, fuel, desc, price) VALUES ('$type', '$make', '$model', '$enginesize', '$fuel', '$desc', '$price')";
mysql_query($query) or die(mysql_error()); 
SpottyDog is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-23-2007, 11:07 AM Re: PHP and MySQL error
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
PHP Code:
$query "INSERT INTO vehicles (type, make, model, esize, fuel, desc, price) VALUES.... 
desc is a mysql keyword, thats why you are getting the error.That's why it's always good practise to use quote (``) with table name and field name.

Your query should be:
PHP Code:
$query "INSERT INTO `vehicles` (`type`, `make`, `model`, `esize`, `fuel`, `desc`, `price`) VALUES.... 
Happy programming.
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Old 04-24-2007, 08:02 AM Re: PHP and MySQL error
SpottyDog's Avatar
Skilled Talker

Posts: 82
Trades: 0
thanks mate you are a legend.

Last edited by SpottyDog; 04-24-2007 at 08:25 AM..
SpottyDog is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP and MySQL error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42408 seconds with 12 queries