Re: Newbie: PHP/MySQL (SELECT)

From: Date: Wed, 20 Nov 2002 20:00:44 +0000
Subject: Re: Newbie: PHP/MySQL (SELECT)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125312@lists.php.net to get a copy of this message
On Thursday 21 November 2002 03:53, Mr. BuNgL3 wrote: > Hi... > I'm with a little sintax problem... > The question is that i have two search fields (titulotxt and cdstxt) and i > want to create an mysql condition... i trying: > > $sql1=($titulotxt) ? "titulo like > '%".$titulotxt."%'":""; > $sql2=($cdstxt) ? "cds like '$cdstxt'":""; > $sql="SELECT * FROM divx WHERE" .$sql1 " && " .$sql2 " ORDER > BY titulo"; > > but he's giving me a sintax error on the 3 line... Can anyone > teach me how i must do to validate the mysql condition and make it work? Try: $sql="SELECT * FROM divx WHERE" .$sql1. " && " .$sql2. " ORDER BY titulo"; -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* He thinks by infection, catching an opinion like a cold. */

« previous php.general (#125312) next »