adzie Posted December 17, 2008 Share Posted December 17, 2008 Hello folks, I have my script it works fine I can search for one or more variable, with a very minor error. What I'd like to do is two things. 1) Set the first variable in the drop down box to equal all records as opposed to a specific entry 2) Search for records that are less than 02:00:00 hours and more than 02:00:00 Any help appreciated. <form method="get" action=" "> <Select NAME="type"> <Option VALUE="john">john</option> <Option VALUE="peter">peter</option> <Option VALUE="paul">paul</option> <Option VALUE="martin">martin</option> </Select> <Select NAME="duration"> <Option VALUE="<>02:00:00">less than 2</option> <Option VALUE="<<02:00:00">more than 2</option> </Select> <input type="submit" value="search"> </form> <table border="1"> <?php error_reporting(E_ALL); ini_set('display_errors', 1); $hostName = " "; $userName = " "; $password = " "; $dbName = " "; mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); if($_GET[type] != ''){ $query = mysql_query("select * from records WHERE type='$_GET[type]' and duration'$_GET[duration]'"); while($row =mysql_fetch_array($query)){ echo '<tr>'; echo'<td>'.$row['task'].'</td>'; echo'<td>'.$row['duration'].'</td>'; echo'<td>'.$row['description'].'</td>'; echo '</tr>'; } } echo '</table>'; ?> Link to comment https://forums.phpfreaks.com/topic/137392-search-script-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.