...

View Full Version : query using "LIKE" not reading



sitNsmile
03-25-2010, 07:47 PM
Trying to see why this isn't reading properly. It's probably something simple, usually always is. But here

changed wordgames to static to show you and test. In categories there is "Car Games" but I want it to look for the word "Car" and give me the catid.



$wordgames = "Car";
$check_cat = mysql_query("SELECT * FROM categories WHERE (catname = LIKE \"%$wordgames%\")");
while($row = mysql_fetch_array($check_cat)) {
$catid = $row['catid'];
}
echo $catid."!!!";


anyone see what I am missing?

Fumigator
03-25-2010, 07:48 PM
SELECT * FROM table WHERE column_name LIKE '%Car%'

No equal sign.

sitNsmile
03-25-2010, 07:53 PM
SELECT * FROM table WHERE column_name LIKE '%Car%'

No equal sign.


Awesome it does work. Always those little things that matter. Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum