Problem....

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Zoram
Forum Contributor
Posts: 166
Joined: Sun Aug 18, 2002 3:28 pm
Location: Utah
Contact:

Problem....

Post by Zoram »

їcode]Could not execute query:

SELECT * FROM `Products` WHERE `id` = 'ba03';

Unknown column 'ba03' in 'where clause'ї/code]

How do i get it to work? the id is a varchar... it works when the ba03 is a number with no characters...
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Try putting it in double quotes: "ba03" ... also make sure that your id column can take a value other than a number
User avatar
Zoram
Forum Contributor
Posts: 166
Joined: Sun Aug 18, 2002 3:28 pm
Location: Utah
Contact:

Post by Zoram »

The variable type of id is varchar. And the double quotes didn't work.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

absolutely positive

Post by phpScott »

Are you absolutely sure that 'id' is a varchar. I ran a quick test on a test db i run on my machine and using id and name as test columns and inserted 'ba03' in the id column and it was happy.

I would double check your your table definition and see what it says.

phpScott
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

even if it wasn't varchar it would not produce an sql-error in a WHERE clause.
But anyway this problem is (hopefully) history ;)
Post Reply