olm75 Posted August 6, 2005 Share Posted August 6, 2005 for some reason i cannot add more than one varible when i do an advanced recordset for a search form going to a MySQL database.....dreamweaver makes a varible for me by the name of colname and thats the only one that works. when i try to add another one the advanced search recordset the form doesnt work at all in the results page....can someone help me with a tutorial or example. by the way i have drop down list boxes and textboxes in the form... u can go to nightspotz.com to see the example of what i mean.....i am doing the recordset on the results page not the form page....... Quote Link to comment https://forums.phpfreaks.com/topic/2440-php-multifield-search-form/ Share on other sites More sharing options...
olm75 Posted August 6, 2005 Author Share Posted August 6, 2005 by the way here is the code from DW: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]require_once([/span][span style=\"color:#DD0000\"]\'../Connections/connNightspotz.php\'[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> <?php $currentPage [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_SERVER[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\"PHP_SELF\"[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]$maxRows_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]10[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$pageNum_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]; if (isset([/span][span style=\"color:#0000BB\"]$_GET[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'pageNum_rsSRCH\'[/span][span style=\"color:#007700\"]])) { [/span][span style=\"color:#0000BB\"]$pageNum_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_GET[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'pageNum_rsSRCH\'[/span][span style=\"color:#007700\"]]; } [/span][span style=\"color:#0000BB\"]$startRow_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$pageNum_rsSRCH [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]$maxRows_rsSRCH[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$colname_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"1\"[/span][span style=\"color:#007700\"]; if (isset([/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]])) { [/span][span style=\"color:#0000BB\"]$colname_rsSRCH [/span][span style=\"color:#007700\"]= ([/span][span style=\"color:#0000BB\"]get_magic_quotes_gpc[/span][span style=\"color:#007700\"]()) ? [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]] : [/span][span style=\"color:#0000BB\"]addslashes[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]]); } [/span][span style=\"color:#0000BB\"]mysql_select_db[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$database_connNightspotz[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$connNightspotz[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$query_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]sprintf[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"SELECT * FROM venues WHERE venuename LIKE \'%s%%\' ORDER BY venuename DESC\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$colname_rsSRCH[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$query_limit_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]sprintf[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"%s LIMIT %d, %d\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$query_rsSRCH[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$startRow_rsSRCH[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$maxRows_rsSRCH[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$query_limit_rsSRCH[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$connNightspotz[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]()); [/span][span style=\"color:#0000BB\"]$row_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_assoc[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$rsSRCH[/span][span style=\"color:#007700\"]); if (isset([/span][span style=\"color:#0000BB\"]$_GET[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'totalRows_rsSRCH\'[/span][span style=\"color:#007700\"]])) { [/span][span style=\"color:#0000BB\"]$totalRows_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_GET[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'totalRows_rsSRCH\'[/span][span style=\"color:#007700\"]]; } else { [/span][span style=\"color:#0000BB\"]$all_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$query_rsSRCH[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$totalRows_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_num_rows[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$all_rsSRCH[/span][span style=\"color:#007700\"]); } [/span][span style=\"color:#0000BB\"]$totalPages_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]ceil[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$totalRows_rsSRCH[/span][span style=\"color:#007700\"]/[/span][span style=\"color:#0000BB\"]$maxRows_rsSRCH[/span][span style=\"color:#007700\"])-[/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$queryString_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]; if (!empty([/span][span style=\"color:#0000BB\"]$_SERVER[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'QUERY_STRING\'[/span][span style=\"color:#007700\"]])) { [/span][span style=\"color:#0000BB\"]$params [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]explode[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"&\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$_SERVER[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'QUERY_STRING\'[/span][span style=\"color:#007700\"]]); [/span][span style=\"color:#0000BB\"]$newParams [/span][span style=\"color:#007700\"]= array(); foreach ([/span][span style=\"color:#0000BB\"]$params [/span][span style=\"color:#007700\"]as [/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"]) { if ([/span][span style=\"color:#0000BB\"]stristr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"pageNum_rsSRCH\"[/span][span style=\"color:#007700\"]) == [/span][span style=\"color:#0000BB\"]false [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]stristr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"totalRows_rsSRCH\"[/span][span style=\"color:#007700\"]) == [/span][span style=\"color:#0000BB\"]false[/span][span style=\"color:#007700\"]) { [/span][span style=\"color:#0000BB\"]array_push[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$newParams[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"]); } } if ([/span][span style=\"color:#0000BB\"]count[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$newParams[/span][span style=\"color:#007700\"]) != [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]) { [/span][span style=\"color:#0000BB\"]$queryString_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"&\" [/span][span style=\"color:#007700\"]. [/span][span style=\"color:#0000BB\"]htmlentities[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]implode[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"&\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$newParams[/span][span style=\"color:#007700\"])); } } [/span][span style=\"color:#0000BB\"]$queryString_rsSRCH [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]sprintf[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"&totalRows_rsSRCH=%d%s\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$totalRows_rsSRCH[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$queryString_rsSRCH[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$queryString_rsSrch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]; if (!empty([/span][span style=\"color:#0000BB\"]$_SERVER[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'QUERY_STRING\'[/span][span style=\"color:#007700\"]])) { [/span][span style=\"color:#0000BB\"]$params [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]explode[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"&\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$_SERVER[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'QUERY_STRING\'[/span][span style=\"color:#007700\"]]); [/span][span style=\"color:#0000BB\"]$newParams [/span][span style=\"color:#007700\"]= array(); foreach ([/span][span style=\"color:#0000BB\"]$params [/span][span style=\"color:#007700\"]as [/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"]) { if ([/span][span style=\"color:#0000BB\"]stristr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"pageNum_rsSrch\"[/span][span style=\"color:#007700\"]) == [/span][span style=\"color:#0000BB\"]false [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]stristr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"totalRows_rsSrch\"[/span][span style=\"color:#007700\"]) == [/span][span style=\"color:#0000BB\"]false[/span][span style=\"color:#007700\"]) { [/span][span style=\"color:#0000BB\"]array_push[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$newParams[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$param[/span][span style=\"color:#007700\"]); } } if ([/span][span style=\"color:#0000BB\"]count[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$newParams[/span][span style=\"color:#007700\"]) != [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"]) { [/span][span style=\"color:#0000BB\"]$queryString_rsSrch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"&\" [/span][span style=\"color:#007700\"]. [/span][span style=\"color:#0000BB\"]htmlentities[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]implode[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"&\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$newParams[/span][span style=\"color:#007700\"])); } } [/span][span style=\"color:#0000BB\"]$queryString_rsSrch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]sprintf[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"&totalRows_rsSrch=%d%s\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$totalRows_rsSrch[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$queryString_rsSrch[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> <?php $query_venues [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"DELETE FROM venue\"[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$query_venue[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$srch[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> [/span] [span style=\"color:#0000BB\"]<?php mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$rsSRCH[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$rsSchRlt[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Quote Link to comment https://forums.phpfreaks.com/topic/2440-php-multifield-search-form/#findComment-8085 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.