Jump to content


Photo

MySQL feild with spaces


  • Please log in to reply
3 replies to this topic

#1 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 28 March 2006 - 08:15 PM

I have a feild in a database that is called "Bake & Method".

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 ''Bake & Method', Weight, Standard_Price) VALUES ('', '2', '3', '

i have the code as:

"INSERT INTO Products (Product_Cat_ID, Name, Description, Picture, 'Bake & Method', Weight, Standard_Price) VALUES ('$product_cat_id', '$name', '$description', '$picture', '$bakemethod', '$weight', '$standardprice') "

Why doesnt it accept it in the ' '
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 28 March 2006 - 08:21 PM

First of all, using an ampersand in a fieldname is NOT a good idea. Talk about asking for trouble.

Secondly, if Product_Cat_ID is an auto_increment field, you can leave it out entirely. It'll fill itself in. If it's not an auto_increment field and you've specified that it cannot be empty/null, it's not going to accept it.

Info: PHP Manual


#3 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 28 March 2006 - 08:27 PM

the product cat id is just a number from 1 to 8, as in catogory ID.
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 28 March 2006 - 08:32 PM

Then why isn't something in the query?!?!?

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users