Jump to content


Photo

**solved** PHP Code WHERE cause dose not work


  • Please log in to reply
2 replies to this topic

#1 darkangel220

darkangel220
  • Members
  • Pip
  • Newbie
  • 2 posts
  • LocationBradford, West Yorkshire, UK

Posted 24 April 2006 - 07:11 PM

I've been having a bit of a problem with getting some information from the mysql database.
The problem I wanted to solve was to have all the information that containted the word Amature in the rank colom to only be displayed.

This part of the script.

$sql = 'SELECT * FROM `Cooking_guild` WHERE `rank`=Amateur ORDER BY `lvl_cap` ASC ';

For some resion it comes up with this error:
Unknown column 'Amateur' in 'where clause'

But if I replace the word with a number like 500 there is no error at all, but cause I wanted all the amaterur rank info displayed and since 500 is not even a rank it dose not work.

Where am I going wrong here?
Best Regards[br]Dark Angel

#2 rab

rab
  • Members
  • PipPipPip
  • Advanced Member
  • 155 posts

Posted 24 April 2006 - 07:13 PM

your listing your columns wrong

try this

$sql = "SELECT * FROM Cooking_guild WHERE rank='Amateur' ORDER BY lvl_cap ASC ";

ect..


#3 darkangel220

darkangel220
  • Members
  • Pip
  • Newbie
  • 2 posts
  • LocationBradford, West Yorkshire, UK

Posted 24 April 2006 - 07:15 PM

Thank you so much for this.

I've been out of php for a good year, so I'm kind of new again.

This has solved my headace.

/bow
Best Regards[br]Dark Angel




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users