Jump to content


Photo

multifield form search


  • Please log in to reply
29 replies to this topic

#1 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 05 August 2005 - 08:49 PM

i'm trying to make a form with multiple text and list menus that query a MySQL database with PHP......can anyone give me an example with multiple fields of one of a tutorial that may help me accomplish this, preferrably one that i can do it with the help of dreamweaver....and also i need to make it were the search results primary ex. venue name is an hyperlink to a detailed page....so the viewers can get more information about the venue.....or topic searching for....

#2 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 05 August 2005 - 10:00 PM

I dont have a tutorial for this but here is a page I have that does want your asking for. Have to do this in three posts lol

page1.php

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
[/span][span style=\"color:#FF8000\"]//Function Sets Session Connect Variable
[/span][span style=\"color:#0000BB\"]session_start[/span][span style=\"color:#007700\"]();
[/span][span style=\"color:#0000BB\"]session_register[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"mysql_mylink\"[/span][span style=\"color:#007700\"]);
require([/span][span style=\"color:#DD0000\"]\"pagelook.inc\"[/span][span style=\"color:#007700\"]);
echo [/span][span style=\"color:#DD0000\"]\"<font size=\'8\' color=\'#000000\'><H1 align=center>Arrester Search Request</H1></font>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<center><form action=page2.php method=post>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]     [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#DD0000\"]\"<TABLE BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<td>*Type:</td><td><INPUT maxLength=50 name=ArresterType size=30></td></tr>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<td>Mcov:</td><td><INPUT maxLength=50 name=ArresterMcov size=30></td></tr>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<td>Rating:</td><td><INPUT maxLength=50 name=ArresterRating size=30></td></tr>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<td>Creep:</td><td><INPUT maxLength=50 name=ArresterCreep size=30></td></tr>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<td>Description:</td><td><INPUT maxLength=50 name=ArresterDescription size=30</td></tr>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<td>*MultiRated :</td><td><select name=ArresterMultiRated>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<option value=\'TRUE\'>TRUE</option>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<option value=\'FALSE\'>FALSE</option>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"</select></td></tr></table>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"<p><input type=submit name=cmd value=\'Search Records\'>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]         echo [/span][span style=\"color:#DD0000\"]\"</FORM>* - Required Fields</center>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]?>[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#3 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 05 August 2005 - 10:06 PM

page2.php Part 1
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<?php
session_start[/span][span style=\"color:#007700\"]();
[/span][span style=\"color:#0000BB\"]session_register[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"mysql_mylink\"[/span][span style=\"color:#007700\"]);
require([/span][span style=\"color:#DD0000\"]\"pagelook.inc\"[/span][span style=\"color:#007700\"]);
echo [/span][span style=\"color:#DD0000\"]\"<font size=\'8\' color=\'#000000\'><H1 align=center>Arrester Search Request</H1></font>\"[/span][span style=\"color:#007700\"];
function [/span][span style=\"color:#0000BB\"]SearchRecordReturnMatch[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$ArresterType[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$ArresterMcov[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$ArresterRating[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$ArresterCreep[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$ArresterDescription[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$ArresterMultiRated[/span][span style=\"color:#007700\"]){
[/span][span style=\"color:#0000BB\"]$strcnta1 [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]strlen[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$ArresterMultiRated[/span][span style=\"color:#007700\"]);
if ([/span][span style=\"color:#0000BB\"]$strcnta1 [/span][span style=\"color:#007700\"]> [/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"]) {
   echo [/span][span style=\"color:#DD0000\"]\"<TABLE BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"<TD>Type</TD><TD>Mcov</TD><TD>Rated</TD><TD>Creep</TD><TD>Description</TD><TD>Multi Rated</TD><TR>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$ArresterType[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$ArresterMcov[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$ArresterRating[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$ArresterCreep[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$ArresterDescription[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$ArresterMultiRated[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"</TR></table><p>\"[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"all_arr\"[/span][span style=\"color:#007700\"]);
   echo [/span][span style=\"color:#DD0000\"]\"<TABLE class=\'sortable\' id=\'allarr1\' BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"<TD>Catalog Number</TD><TD>Type</TD><TD>Mcov</TD><TD>Rated</TD><TD>Creep</TD><TD>Description</TD>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"<TD>Customer</TD><TD>Stat</TD><TD>Multi Rated</TD><TD>First Mcov</TD><TD>Second Mcov</TD>\"[/span][span style=\"color:#007700\"];
   echo [/span][span style=\"color:#DD0000\"]\"<TD>Third Mcov</TD><TD>Fourth Mcov</TD><TD>Color</TD>\"[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]$MinArrCrp [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$ArresterCreep [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]0.90[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]$MinArrMcov [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$ArresterMcov [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]0.90[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]$MinArrRating [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$ArresterRating [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]0.90[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]$MaxArrCrp [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$ArresterCreep [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]1.10[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]$MaxArrMcov [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$ArresterMcov [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]1.10[/span][span style=\"color:#007700\"];
   [/span][span style=\"color:#0000BB\"]$MaxArrRating [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$ArresterRating [/span][span style=\"color:#007700\"]* [/span][span style=\"color:#0000BB\"]1.10[/span][span style=\"color:#007700\"];
[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#4 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 05 August 2005 - 10:07 PM

page2.php Part 2
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]   if ($ArresterCreep != \"\" && $ArresterMcov != \"\" && $ArresterRating != \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Rating between $MinArrRating and $MaxArrRating) and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep != \"\" && $ArresterMcov != \"\" && $ArresterRating == \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep != \"\" && $ArresterMcov == \"\" && $ArresterRating == \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep != \"\" && $ArresterMcov == \"\" && $ArresterRating != \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Rating between $MinArrRating and $MaxArrRating) and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep == \"\" && $ArresterMcov != \"\" && $ArresterRating != \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Rating between $MinArrRating and $MaxArrRating) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep == \"\" && $ArresterMcov != \"\" && $ArresterRating == \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep == \"\" && $ArresterMcov == \"\" && $ArresterRating != \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Rating between $MinArrRating and $MaxArrRating) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   if ($ArresterCreep == \"\" && $ArresterMcov == \"\" && $ArresterRating == \"\") {$querystring = \"select * from all_arr where (Type like \'$ArresterType%\') and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\";}
   $ArresterSearchMatch = mysql_query ($querystring);
   if ($MatchRecordRow = mysql_fetch_array($ArresterSearchMatch)) {
      do{
         echo \"<TR><td>\".$MatchRecordRow[\'CatalogNumber\'].\"</TD>\";
         echo \"<td>\".$MatchRecordRow[\'Type\'].\"</TD><td>\".$MatchRecordRow[\'Mcov\'].\"</TD>\";
         echo \"<td>\".$MatchRecordRow[\'Rating\'].\"</TD><td>\".$MatchRecordRow[\'Creep\'].\"</TD>\";
         $Description = \'.\';if ($MatchRecordRow[\'Description\'] <> \'\') {$Description = $MatchRecordRow[\'Description\'];}echo \"<td>\".$Description.\"</TD>\";
         $Customer = \'.\';if ($MatchRecordRow[\'Customer\'] <> \'\') {$Customer = $MatchRecordRow[\'Customer\'];}echo \"<td>\".$Customer.\"</TD>\";
         $Stat = \'.\';if ($MatchRecordRow[\'Stat\'] <> \'\') {$Stat = $MatchRecordRow[\'Stat\'];}echo \"<td>\".$Stat.\"</TD>\";
         $ArresterMultiRated = \'.\';if ($MatchRecordRow[\'MultiRated\'] == \'TRUE\') {$ArresterMultiRated = \'YES\';}echo \"<td>\".$ArresterMultiRated.\"</TD>\";
         $FirstUnit = \'.\';$SecondUnit = \'.\';$ThirdUnit = \'.\';$ForthUnit = \'.\';
         if ($ArresterMultiRated == \'YES\') {
                  if ($MatchRecordRow[\'FirstMcov\'] <> \'0\') {$FirstUnit = $MatchRecordRow[\'FirstMcov\'];}
                  if ($MatchRecordRow[\'SecondMcov\'] <> \'0\') {$SecondUnit = $MatchRecordRow[\'SecondMcov\'];}
                  if ($MatchRecordRow[\'ThirdMcov\'] <> \'0\') {$ThirdUnit = $MatchRecordRow[\'ThirdMcov\'];}
                  if ($MatchRecordRow[\'Forth\'] <> \'0\') {$ForthUnit = $MatchRecordRow[\'Forth\'];}
          }
      echo \"<td>\".$FirstUnit.\"</TD><td>\".$SecondUnit.\"</TD>\";echo \"<td>\".$ThirdUnit.\"</TD><td>\".$ForthUnit.\"</TD>\";
      $ArresterColor = \'.\';if ($MatchRecordRow[\'Color\'] <> \'\') {$ArresterColor = $MatchRecordRow[\'Color\'];}echo \"<td>\".$ArresterColor.\"</TD></TR>\";}
   while($MatchRecordRow = mysql_fetch_array($ArresterSearchMatch));}
   else {echo \"<center>Sorry, No Records Were Found!</center>\";}
   echo \"</table>\";
   echo \"<P><font size=\'8\' color=\'#000000\'><H2 align=center>Search Completed</H2></font>\";
} Else {echo \"<center><H1>Please Select MultiRated <font size=\'8\' color=\'red\'>[True]</font> or <font size=\'8\' color=\'red\'>[False]</font></h1></center>\";DataEntryForm();}
mysql_free_result($ArresterSearchMatch);
}

switch($_REQUEST[\'cmd\']){
   default;
   SearchRecordReturnMatch($_POST[\'ArresterType\'],$_POST[\'ArresterMcov\'],$_POST[\'ArresterRating\'],$_POST[\'ArresterCreep\'],$_POST[\'ArresterDescription\'],$_POST[\'ArresterMultiRated\']);
   break;
}
?>
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#5 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 06 August 2005 - 08:30 PM

page2.php Part 2
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]   if ($ArresterCreep != \\\"\\\" && $ArresterMcov != \\\"\\\" && $ArresterRating != \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Rating between $MinArrRating and $MaxArrRating) and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep != \\\"\\\" && $ArresterMcov != \\\"\\\" && $ArresterRating == \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep != \\\"\\\" && $ArresterMcov == \\\"\\\" && $ArresterRating == \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep != \\\"\\\" && $ArresterMcov == \\\"\\\" && $ArresterRating != \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Rating between $MinArrRating and $MaxArrRating) and (Creep between $MinArrCrp and $MaxArrCrp) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep == \\\"\\\" && $ArresterMcov != \\\"\\\" && $ArresterRating != \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Rating between $MinArrRating and $MaxArrRating) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep == \\\"\\\" && $ArresterMcov != \\\"\\\" && $ArresterRating == \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Mcov between $MinArrMcov and $MaxArrMcov) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep == \\\"\\\" && $ArresterMcov == \\\"\\\" && $ArresterRating != \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Rating between $MinArrRating and $MaxArrRating) and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   if ($ArresterCreep == \\\"\\\" && $ArresterMcov == \\\"\\\" && $ArresterRating == \\\"\\\") {$querystring = \\\"select * from all_arr where (Type like \'$ArresterType%\') and (Description like\'%$ArresterDescription%\') and (MultiRated like \'$ArresterMultiRated\') order by Creep,CatalogNumber\\\";}
   $ArresterSearchMatch = mysql_query ($querystring);
   if ($MatchRecordRow = mysql_fetch_array($ArresterSearchMatch)) {
      do{
         echo \\\"<TR><td>\\\".$MatchRecordRow[\'CatalogNumber\'].\\\"</TD>\\\";
         echo \\\"<td>\\\".$MatchRecordRow[\'Type\'].\\\"</TD><td>\\\".$MatchRecordRow[\'Mcov\'].\\\"</TD>\\\";
         echo \\\"<td>\\\".$MatchRecordRow[\'Rating\'].\\\"</TD><td>\\\".$MatchRecordRow[\'Creep\'].\\\"</TD>\\\";
         $Description = \'.\';if ($MatchRecordRow[\'Description\'] <> \'\') {$Description = $MatchRecordRow[\'Description\'];}echo \\\"<td>\\\".$Description.\\\"</TD>\\\";
         $Customer = \'.\';if ($MatchRecordRow[\'Customer\'] <> \'\') {$Customer = $MatchRecordRow[\'Customer\'];}echo \\\"<td>\\\".$Customer.\\\"</TD>\\\";
         $Stat = \'.\';if ($MatchRecordRow[\'Stat\'] <> \'\') {$Stat = $MatchRecordRow[\'Stat\'];}echo \\\"<td>\\\".$Stat.\\\"</TD>\\\";
         $ArresterMultiRated = \'.\';if ($MatchRecordRow[\'MultiRated\'] == \'TRUE\') {$ArresterMultiRated = \'YES\';}echo \\\"<td>\\\".$ArresterMultiRated.\\\"</TD>\\\";
         $FirstUnit = \'.\';$SecondUnit = \'.\';$ThirdUnit = \'.\';$ForthUnit = \'.\';
         if ($ArresterMultiRated == \'YES\') {
                  if ($MatchRecordRow[\'FirstMcov\'] <> \'0\') {$FirstUnit = $MatchRecordRow[\'FirstMcov\'];}
                  if ($MatchRecordRow[\'SecondMcov\'] <> \'0\') {$SecondUnit = $MatchRecordRow[\'SecondMcov\'];}
                  if ($MatchRecordRow[\'ThirdMcov\'] <> \'0\') {$ThirdUnit = $MatchRecordRow[\'ThirdMcov\'];}
                  if ($MatchRecordRow[\'Forth\'] <> \'0\') {$ForthUnit = $MatchRecordRow[\'Forth\'];}
          }
      echo \\\"<td>\\\".$FirstUnit.\\\"</TD><td>\\\".$SecondUnit.\\\"</TD>\\\";echo \\\"<td>\\\".$ThirdUnit.\\\"</TD><td>\\\".$ForthUnit.\\\"</TD>\\\";
      $ArresterColor = \'.\';if ($MatchRecordRow[\'Color\'] <> \'\') {$ArresterColor = $MatchRecordRow[\'Color\'];}echo \\\"<td>\\\".$ArresterColor.\\\"</TD></TR>\\\";}
   while($MatchRecordRow = mysql_fetch_array($ArresterSearchMatch));}
   else {echo \\\"<center>Sorry, No Records Were Found!</center>\\\";}
   echo \\\"</table>\\\";
   echo \\\"<P><font size=\'8\' color=\'#000000\'><H2 align=center>Search Completed</H2></font>\\\";
} Else {echo \\\"<center><H1>Please Select MultiRated <font size=\'8\' color=\'red\'>[True]</font> or <font size=\'8\' color=\'red\'>[False]</font></h1></center>\\\";DataEntryForm();}
mysql_free_result($ArresterSearchMatch);
}

switch($_REQUEST[\'cmd\']){
   default;
   SearchRecordReturnMatch($_POST[\'ArresterType\'],$_POST[\'ArresterMcov\'],$_POST[\'ArresterRating\'],$_POST[\'ArresterCreep\'],$_POST[\'ArresterDescription\'],$_POST[\'ArresterMultiRated\']);
   break;
}
?>[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

View Post



#6 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 06 August 2005 - 08:31 PM

dude i dont even know how to read this do u have an working example some where so i can get a better understanding.......

#7 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 07 August 2005 - 08:01 PM

Multi_Seach Document

Ok Try this Baisc But I have tried to explame it.


If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#8 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 08 August 2005 - 05:02 AM

Multi_Seach Document

Ok Try this Baisc But I have tried to explame it.

View Post



#9 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 08 August 2005 - 05:03 AM

try what, the link doesnt work.....

#10 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 08 August 2005 - 12:09 PM

Sorry Try this one I could not test link from inside my firewall at home
If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#11 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 08 August 2005 - 06:35 PM

ok thanks do u have on with listboxes and other types of fields instead of textboxes...or does it really matter.....
ex: goto my page
nightspotz.com

#12 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 08 August 2005 - 07:09 PM

ok thanks do u have on with listboxes and other types of fields instead of textboxes...or does it really matter.....
ex: goto my page 
nightspotz.com

View Post

It does not matter you still have to set the Name on the list box.

The only difference is the root code on the input page

Text Box for user input
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]echo \"<form action=query.php method=post>\";
echo \"Originator: <INPUT maxLength=50 name=Originator>\";
echo \"<input type=submit name=cmd value=\'Search Records\'>\";
echo \"</FORM>\";[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

List Box feed from database for user select
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$querystring = \"select User_Name,Submitter from tbluser Order by Submitter ASC\";
$SearchMatch = mysql_query ($querystring);
echo \"<form action=query.php method=post>\";
echo \"<select name=Originator>\";
echo \"<option></option>\";
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
    do{
        echo \"<option value=\'\".$MatchRecordRow[\'Submitter\'].\"\'>\".$MatchRecordRow[\'Submitter\'].\"</option>\";
       }
    while($MatchRecordRow = mysql_fetch_array($SearchMatch));
}
echo \"</select>\";
echo \"<input type=submit name=cmd value=\'Search Records\'>\";
echo \"</FORM>\";[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

They are both named Originator either one can be used to get the data.
If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#13 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 08 August 2005 - 08:44 PM

ok i'm getting an error message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/nightsp/public_html/testcode.php on line 38

Sorry, No Records Were Found!

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home2/nightsp/public_html/testcode.php on line 46


and here is the code can you read the notes i put in please thanks, i greatly appreciate this:
by the way $AG = $_POST[agegroup], $VT = $_POST[venuetype]
$MT = $_POST[musictype]; are list boxes as u can see on the page nightspotz.com

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
$VN [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuename[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]areacode[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]agegroup[/span][span style=\"color:#007700\"]];

[/span][span style=\"color:#FF8000\"]//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
[/span][span style=\"color:#0000BB\"]$VT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuetype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$MT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]musictype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#FF8000\"]//-----------------------------------------------------
[/span][span style=\"color:#0000BB\"]  
$HostID [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]localhost[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$UserID [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][*******];
[/span][span style=\"color:#0000BB\"]$PassID [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][*******];
[/span][span style=\"color:#0000BB\"]$dbname [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][********];
[/span][span style=\"color:#0000BB\"]$Table [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venues[/span][span style=\"color:#007700\"]];


[/span][span style=\"color:#FF8000\"]//----------CAN I TAKE THIS TABLE OUT OR WAS THIS JUST TO ECHO AND SEE IF IT WORKS..I DONT NEED ANY OF
//---THESE TABLES I\'LL FORMAT IT IN DREAMWEAVER BUT CAN U SHOW ME HOW TO JUST GET THE RESULTS WITH THE
//----PHP ICON SO I CAN JUST POSITION THEM IN DREAMWEAVER...THANKS...
[/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#DD0000\"]\"<TABLE BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<TD>First Name</TD><TD>Last Name</TD><TD>Street Address</TD><TD>City</TD><TD>State</TD><TR>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$VN[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$AC[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$AG[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$City[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$State[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"</td>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"</TR></table><p>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#FF8000\"]//---------------------------------------------------------------------------------------------

[/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$dbname[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#0000BB\"]$mysql_mylink [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_pconnect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$HostID[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$UserID[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$PassID[/span][span style=\"color:#007700\"]);
echo [/span][span style=\"color:#DD0000\"]\"<TABLE class=\'sortable\' id=\'Identify\' BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<TD>VENUENAME</TD><TD>AREACODE</TD><TD>Street Address</TD><TD>city</TD><TD>state</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"select * from \'$Table\'\"[/span][span style=\"color:#007700\"];
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') and (areacode like \'%$AC%\') and (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') and (areacode like \'%$AC%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') and (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
[/span][span style=\"color:#0000BB\"]$SearchMatch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$querystring[/span][span style=\"color:#007700\"]);
if ([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"])) {
[/span][span style=\"color:#0000BB\"]   do[/span][span style=\"color:#007700\"]{
[/span][span style=\"color:#0000BB\"]      echo [/span][span style=\"color:#DD0000\"]\"<TR><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'areacode\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'agegroup\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'city\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'state\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
} while([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]));
} else {echo [/span][span style=\"color:#DD0000\"]\"<center>Sorry, No Records Were Found!</center>\"[/span][span style=\"color:#007700\"];}
echo [/span][span style=\"color:#DD0000\"]\"</table>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#0000BB\"]?>[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

#14 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 09 August 2005 - 08:05 AM

ok i fixed some of the problems but now the the variables arent working because i cant do any type of search i can only hit submit but i think the SQL qyery is jacked up can you help with this i want the viewers to be able to search by using 1 or all of the search fields to narrow the search down.....
here is the working form...
http://www.nightspot.../testsearch.php
can you go and check it out
oh by the way the mistake was
$querystring = "select * from '$Table'";
had to get rid of the ' ' around the $Table.....
can you help with the rest please...you dont know how much of a relief this is...

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
$VN [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuename[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]areacode[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]agegroup[/span][span style=\"color:#007700\"]];

[/span][span style=\"color:#FF8000\"]//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
[/span][span style=\"color:#0000BB\"]$VT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuetype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$MT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]musictype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#FF8000\"]//-----------------------------------------------------


[/span][span style=\"color:#0000BB\"]$mysql_mylink [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_pconnect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]localhost[/span][span style=\"color:#007700\"], *****, *****) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
[/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"](********) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
echo [/span][span style=\"color:#DD0000\"]\"<TABLE class=\'sortable\' id=\'Identify\' BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"select * from venues\"[/span][span style=\"color:#007700\"];
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') and (areacode like \'%$AC%\') and (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') and (areacode like \'%$AC%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]&& [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') and (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
[/span][span style=\"color:#0000BB\"]$SearchMatch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$querystring[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$mysql_mylink[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
if ([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"])) {
   do{
      echo [/span][span style=\"color:#DD0000\"]\"<TR><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'areacode\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'agegroup\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'city\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'state\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
} while([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]));
} else {echo [/span][span style=\"color:#DD0000\"]\"<center>Sorry, No Records Were Found!</center>\"[/span][span style=\"color:#007700\"];}
echo [/span][span style=\"color:#DD0000\"]\"</table>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#0000BB\"]?>
[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

#15 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 09 August 2005 - 12:21 PM

Ok I see one thing where in the query string you would need a space built in string
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$querystring = \"select * from venues\";
if ($VN != \"\" && $AC != \"\" && $AG != \"\") {$querystring = $guerystring + \"where (venuename like \'%$VN%\') and (areacode like \'%$AC%\') and (agegroup like \'%$AG%\')\";}
if ($VN != \"\" && $AC != \"\" && $AG == \"\") {$querystring = $guerystring + \"where (venuename like \'%$VN%\') and (areacode like \'%$AC%\')\";}
if ($VN != \"\" && $AC == \"\" && $AG == \"\") {$querystring = $guerystring + \"where (venuename like \'%$VN%\')\";}
if ($VN != \"\" && $AC == \"\" && $AG != \"\") {$querystring = $guerystring + \"where (venuename like \'%$VN%\') and (agegroup like \'%$AG%\')\";} [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Like this
[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$querystring = \"select * from venues\";
$querystring = $guerystring +\" where (venuename like \'%$VN%\')\";}[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Otherwise your string will look like this on add
select * from venueswhere (venuename like '%$VN%')

If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#16 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 10 August 2005 - 05:01 AM

ok either im blind, or dumb ass hell but wjat did u change besides the space between +" where
can u change the code to say what u mean can u put the correction in the code itself......then maybe i can see it alot better....

#17 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 10 August 2005 - 09:14 AM

ok here is my code but im getting an error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
$VN [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuename[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]areacode[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]agegroup[/span][span style=\"color:#007700\"]];

[/span][span style=\"color:#FF8000\"]//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
[/span][span style=\"color:#0000BB\"]$VT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuetype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$MT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]musictype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#FF8000\"]//-----------------------------------------------------


[/span][span style=\"color:#0000BB\"]$mysql_mylink [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_pconnect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"localhost\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"nightsp\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"babystuff\"[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
[/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]nightsp_nightspotz[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
echo [/span][span style=\"color:#DD0000\"]\"<TABLE class=\'sortable\' id=\'Identify\' BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"select * from venues\"[/span][span style=\"color:#007700\"];
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!=[/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"where (venuename like \'%$VN%\') \"[/span][span style=\"color:#007700\"];}

if ([/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!=[/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"and (areacode like \'%$AC%\') \"[/span][span style=\"color:#007700\"];}

if ([/span][span style=\"color:#0000BB\"]$AG[/span][span style=\"color:#007700\"]!=[/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\"and (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}


[/span][span style=\"color:#0000BB\"]$SearchMatch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$querystring[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$mysql_mylink[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
if ([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"])) {
   do{
      echo [/span][span style=\"color:#DD0000\"]\"<TR><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'areacode\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'agegroup\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'city\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'state\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
} while([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]));
} else {echo [/span][span style=\"color:#DD0000\"]\"<center>Sorry, No Records Were Found!</center>\"[/span][span style=\"color:#007700\"];}
echo [/span][span style=\"color:#DD0000\"]\"</table>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]);

[/span][span style=\"color:#0000BB\"]?>
[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]



#18 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 10 August 2005 - 03:50 PM

Clause for each type of match needs to be added and spacing in the right place in the case (Below) the space will be added at the addition of the second part of the string [ Where......]

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
$VN [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuename[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]areacode[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]agegroup[/span][span style=\"color:#007700\"]];

[/span][span style=\"color:#FF8000\"]//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
[/span][span style=\"color:#0000BB\"]$VT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]venuetype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#0000BB\"]$MT [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$_POST[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]musictype[/span][span style=\"color:#007700\"]];
[/span][span style=\"color:#FF8000\"]//-----------------------------------------------------
[/span][span style=\"color:#0000BB\"]$mysql_mylink [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_pconnect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"localhost\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"nightsp\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"babystuff\"[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
[/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]nightsp_nightspotz[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
echo [/span][span style=\"color:#DD0000\"]\"<TABLE class=\'sortable\' id=\'Identify\' BORDER=1 align=center>\"[/span][span style=\"color:#007700\"];
echo [/span][span style=\"color:#DD0000\"]\"<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"select * from venues\"[/span][span style=\"color:#007700\"];
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\" where (venuename like \'%$VN%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\" where (venuename like \'%$VN%\') AND (areacode like \'%$AC%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\" where (venuename like \'%$VN%\') AND (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\" where (areacode like \'%$AC%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\" where (areacode like \'%$AC%\') AND (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]!= [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {[/span][span style=\"color:#0000BB\"]$querystring [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$guerystring [/span][span style=\"color:#007700\"]+ [/span][span style=\"color:#DD0000\"]\" where (agegroup like \'%$AG%\')\"[/span][span style=\"color:#007700\"];}
if ([/span][span style=\"color:#0000BB\"]$VN [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AC [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\" [/span][span style=\"color:#007700\"]AND [/span][span style=\"color:#0000BB\"]$AG [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#DD0000\"]\"\"[/span][span style=\"color:#007700\"]) {}
[/span][span style=\"color:#0000BB\"]$SearchMatch [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query [/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$querystring[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$mysql_mylink[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]());
if ([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"])) {
[/span][span style=\"color:#0000BB\"]   do[/span][span style=\"color:#007700\"]{
[/span][span style=\"color:#0000BB\"]      echo [/span][span style=\"color:#DD0000\"]\"<TR><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'venuename\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'areacode\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'agegroup\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]      echo [/span][span style=\"color:#DD0000\"]\"<td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'city\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD><td>\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$MatchRecordRow[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'state\'[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"</TD>\"[/span][span style=\"color:#007700\"];
} while([/span][span style=\"color:#0000BB\"]$MatchRecordRow [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_array[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]));
} else {echo [/span][span style=\"color:#DD0000\"]\"<center>Sorry, No Records Were Found!</center>\"[/span][span style=\"color:#007700\"];}
echo [/span][span style=\"color:#DD0000\"]\"</table>\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$SearchMatch[/span][span style=\"color:#007700\"]);

[/span][span style=\"color:#0000BB\"]?>[/span]
[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

View Post

[/quote]
If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#19 ecstasy

ecstasy
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 10 August 2005 - 04:40 PM

i'm trying to make a form with multiple text and list menus that query a MySQL database with PHP......can anyone give me an example with multiple fields of one of a tutorial that may help me accomplish this, preferrably one that i can do it with the help of dreamweaver....and also i need to make it were the search results primary ex. venue name is an hyperlink to a detailed page....so the viewers can get more information about the venue.....or topic searching for....

View Post



The things are not quite so complicated! Try smth like that:

$QueryString = "SELECT * FROM table_name ";

if (isset($_POST['your_form_field'])) {
  $Crt = $_POST['your_form_field'];
  $QueryString .= " WHERE table_field LIKE %\"$Crt\"%";
}

You use such "if" statements for all your search criterias, to build up a dynamic SQL Query.

After you finished, try to run the query.

Enjoy

#20 olm75

olm75
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 11 August 2005 - 11:09 PM

ok that just tells me the query was empty when i submit the form .....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users