Got it sorted out now....

> > $query_rsCat = "SELECT * FROM inventory WHERE category='$sltCat' OR
> > item_name LIKE '%$txtSearch%'";

>>This will select all the items if either $sltCat or $txtSearch is empty.

>>Janet

'%$txtSearch%' would always evaulate as '%%' in Mysql when the txtSearch
field is empty thus resulting in Mysql selecting everything in the database
making the the "category='$sltCat'" redundant.......

I've rewritten it as:

if(empty($txtSearch)){
 $query_rsCat= "SELECT * FROM inventory WHERE category='$sltCat'";
}
else {
 $query_rsCat="SELECT * FROM inventory WHERE item_name LIKE '%$txtSearch%'";
}

to circumvent this and it worked......

Thanks Janet for pointing this out.......and thanks all for the help....

Dennis

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tuesday 17 June 2003 05:45, Dennis Martin Ong wrote:
>
> > Is there
> > something I've missed out cos it seems like the $sltCat which is suppose
to
> > pass the selected option value when the form is submitted is not passing
> > the correct value,
>
> So have you verified that it passes the value as expected or what?
>
> > $query_rsCat = "SELECT * FROM inventory WHERE category='$sltCat' OR
> > item_name LIKE '%$txtSearch%'";
>
> And have you checked that $query_rsCat contains what you expected it to
> contain?
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Sometimes, when I think of what that girl means to me, it's all I can do
> to keep from telling her.
> -- Andy Capp
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to