Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- mysql query issue


lostdreamer - 10:24 am on Sep 13, 2012 (gmt 0)


if you want to view all the pages for all the categories, you should not have a WHERE clause there ;)


if(isSet($category) && $category != "")
$query = "SELECT * FROM pages WHERE category='". $category ."' ORDER BY name";
else
$query = "SELECT * FROM pages ORDER BY name";


Something like that.

What you **could** do, but note this is NOT best practise:

$query = "SELECT * FROM pages WHERE category LIKE '". $category ."' ORDER BY name";


With LIKE instead of WHERE you can do wildcard searches by using "%" so " category LIKE '%' " gives you all results


Thread source:: http://www.webmasterworld.com/php/4494486.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com