timmah1 Posted March 24, 2008 Share Posted March 24, 2008 I'm trying to do this search <input type="text" name="find" /> in <select name="field"> <option value="j_number">Job Number</option> <option value="j_salesperson">Salesperson</option> <option value="j_location">Location</option> <option value="j_company">Company</option> </select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" / here is the search function $find = strtoupper($_POST['find']); $find = strip_tags($_POST['find']); $find = trim ($_POST['find']); $data = mysql_query("SELECT * FROM orders WHERE upper($field) LIKE '%$find%'"); while($result = mysql_fetch_array( $data )) { But no matter what I search for , it always gives me this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/cheezy/public_html/plumbing/pages/page.search.inc.php on line 27 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/cheezy/public_html/plumbing/pages/page.search.inc.php on line 49 Sorry, but we can not find an entry to match your query Any idea why? Thanks for your help in advance Link to comment https://forums.phpfreaks.com/topic/97690-searching/ Share on other sites More sharing options...
BlueSkyIS Posted March 24, 2008 Share Posted March 24, 2008 $data = mysql_query("SELECT * FROM orders WHERE upper($field) LIKE '%$find%'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/97690-searching/#findComment-499881 Share on other sites More sharing options...
timmah1 Posted March 24, 2008 Author Share Posted March 24, 2008 I probably should start using or die(mysql_error()); I had a variable wrong, now it works. Thank you BlueSkyIS Link to comment https://forums.phpfreaks.com/topic/97690-searching/#findComment-499887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.