mysql error - column 'category_id' in where clause is ambiguous

Mobile
feeds
Welcome Login | Register

mysql error - column 'category_id' in where clause is ambiguous
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » MYSQL Forums
        » » mysql error - column 'category_id' in where clause is ambiguous
mysql error - column 'category_id' in where clause is ambiguous
Post Description: mysql error column category id in where clause is ambiguous MYSQL
Post Tags:
This Post Has Been Viewed 42 Times Since Fri Dec 26, 2008 12:29 am Author wallpaperama with 0 replies
mysql error - column 'category_id' in where clause is ambiguous
Advertise On This Page




hi i need to know i am getting this error when i run a query on mysql with php?

well, if you are also asking this question to yourself, i know the answer. i will show you the fix.

that is, how i was able to fix it.

basically if you are getting this error its because you probably have a mispelling on your mysql query that you are trying to run with php.

it happened to me, i was going crazy trying to find out what was going on.

if you are getting this, its human error, you need to check carefully your mysql query. really!

if you're mysql query its pretty long, you just have to be patient and check it, make sure you put commas and you spelled the tables and fields correctly.

fist step is change the fields to the wild for example i have this query:

$sql = "SELECT name,date,locotion,status,age,password,category_id,id FROM users WHERE usersid=256";


as you can see from my query, have misspelled location, i put locotion instead. so one way to make sure you dont have a mispelled field is to use the wild card (*) so this is how i would chage mysql query:

$sql = "SELECT * FROM users WHERE usersid=256";


see if it fails, if it doesnt fail, then it means you mispelled a field.

in my situation, this is how mysql query looked like:

$sql = "SELECT w.name,w.locotion,w.status,c.name,w.link,w.id,category_id c.date, FROM users u, cats c WHERE c.category_id =w.id AND w.status='active'";


as you can see from my query, i should dont have a comman after c.category_id, so once i put the command, i didnt get the error anymore

hope that helps



Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : mysql error - column 'category_id' in where clause is ambiguous

Comments and replies About mysql error - column 'category_id' in where clause is ambiguous
(0) Comments