davidycpsrep Posted January 8, 2009 Share Posted January 8, 2009 Here is what I am trying to do... I have a search page with 7 different search fields i.e. lastname, firstname, source,type ect. inside a form with a button called search. I have another page that is a table that shows all information unless a search is initiated then it shows the results. I got it working for 1 field (lastname) what I cant figure out is how to get it to work for all the fields. attached php of working file. Any help will be appreciated i can even paypal the genius who figures this out a few bucks. I have tried the OR function in my query $query_Search = "SELECT * FROM sales WHERE sales.last_name LIKE '%%$colname_Search%%' OR sales.first_name LIKE '%%$colname2_Search%%' didnt work lastname search working at http://www.baricfunding.com/leadv2/ ORDER BY sales.dateoflead"; [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/140088-multiple-search-field-problem/ Share on other sites More sharing options...
.josh Posted January 8, 2009 Share Posted January 8, 2009 Overlooking the fact that your code is horribly written, way outdated, and very insecure, when you tried putting another variable into your query, did you actually set the variable? For example, for your first variable, you have this: $colname_Search = "1"; if (isset($HTTP_GET_VARS['searchLastName'])) { $colname_Search = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['searchLastName'] : addslashes($HTTP_GET_VARS['searchLastName']); } Did you do that for your 2nd variable? Link to comment https://forums.phpfreaks.com/topic/140088-multiple-search-field-problem/#findComment-732948 Share on other sites More sharing options...
davidycpsrep Posted January 9, 2009 Author Share Posted January 9, 2009 I did the following $colname2_Search = "1"; if (isset($HTTP_GET_VARS['searchFirstName'])) { $colname2_Search = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['searchFirstName'] : addslashes($HTTP_GET_VARS['searchFirstName']); } I am teaching my self and I realize my code is sloppy. Link to comment https://forums.phpfreaks.com/topic/140088-multiple-search-field-problem/#findComment-732957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.