$sql1 = "titulo like '%$titulotxt%'"
$sql2 = "cd like '$cdstxt'";
$sql = "SELECT * FROM divx WHERE $sql1 AND $sql2 ORDER BY titulo";

I think you are getting the error because of the ($titulotxt) ? portion of
your sql statements.  You really only need the two statements listed above
and then put into your actual sql statement.

Robbert van Andel 

-----Original Message-----
From: Mr. BuNgL3 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 11:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie: PHP/MySQL (SELECT)


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?
Thanks





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


 "The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers." 


Reply via email to