Searching MySQL with PHP
Posted by:
Crow
Date: August 10, 2005 08:53AM
Having two fields in a web page used for searching:
<tr><td align="right">
Description:</td><td><input type="text" name="description" value="" size="30" maxlength="30">
</td></tr><br>
<tr><td align="right">
Color:</td><td><input type="text" name="color" value="" size="30" maxlength="30">
</td></tr><br>
If I only fill in color and don't want it to search description what do I do? I have:
$sql="select id, description, color from tablename where description = '".$_REQUEST["description"]."' or color = '".$_REQUEST["color"]."'
If I just enter color blue and search I get this:
select id, description, color from tablename where description ='' or color='blue'
But I dont want to have description searcherd since i didn't enter anything.
Thoughts?
Subject
Written By
Posted
Searching MySQL with PHP
August 10, 2005 08:53AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.