Re: Dynamic menu not passing value to PHP?

From: Date: Tue, 17 Jun 2003 10:29:24 +0000
Subject: Re: Dynamic menu not passing value to PHP?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-151810@lists.php.net to get a copy of this message
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" <php-general@gremlins.biz> wrote in message news:200306171434.13240.php-general@gremlins.biz... > 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 > */ >

« previous php.general (#151810) next »