> 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";
and add a space after the WHERE. Also consider the positioning of the single quotes (') and double-quotes (") in the $sql1 assignment statement - they must be nested. Finally, consider echoing sql1, $sql2, and $sql to be able to see with your own eyes! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php