Newbie: PHP/MySQL (SELECT)
| From: | Mr. BuNgL3 | Date: | Wed, 20 Nov 2002 19:53:36 +0000 |
| Subject: | Newbie: PHP/MySQL (SELECT) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125310@lists.php.net to get a copy of this message | ||
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