error message in form

  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 8th, 2005, 9:18 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 Code: [ Download ] [ Select ]
 
<?php
 
$VN = $_POST[venuename];
 
$AC = $_POST[areacode];
 
$AG = $_POST[agegroup];
 
 
 
//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
 
$VT = $_POST[venuetype];
 
$MT = $_POST[musictype];
 
//-----------------------------------------------------
 
 
 
$HostID = $_POST[localhost];
 
$UserID = $_POST[*******];
 
$PassID = $_POST[*******];
 
$dbname = $_POST[********];
 
$Table = $_POST[venues];
 
 
 
 
 
//----------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...
 
echo "<TABLE BORDER=1 align=center>";
 
echo "<TD>First Name</TD><TD>Last Name</TD><TD>Street Address</TD><TD>City</TD><TD>State</TD><TR>";
 
echo "<td>".$VN."</td><td>".$AC."</td><td>".$AG."</td>";
 
echo "<td>".$City."</td><td>".$State."</td>";
 
echo "</TR></table><p>";
 
//---------------------------------------------------------------------------------------------
 
 
 
mysql_select_db ($dbname);
 
$mysql_mylink = mysql_pconnect($HostID, $UserID, $PassID);
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>Street Address</TD><TD>city</TD><TD>state</TD>";
 
$querystring = "select * from '$Table'";
 
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%')";}
 
$SearchMatch = mysql_query ($querystring);
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $VN = $_POST[venuename];
  5.  
  6. $AC = $_POST[areacode];
  7.  
  8. $AG = $_POST[agegroup];
  9.  
  10.  
  11.  
  12. //-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
  13.  
  14. $VT = $_POST[venuetype];
  15.  
  16. $MT = $_POST[musictype];
  17.  
  18. //-----------------------------------------------------
  19.  
  20.  
  21.  
  22. $HostID = $_POST[localhost];
  23.  
  24. $UserID = $_POST[*******];
  25.  
  26. $PassID = $_POST[*******];
  27.  
  28. $dbname = $_POST[********];
  29.  
  30. $Table = $_POST[venues];
  31.  
  32.  
  33.  
  34.  
  35.  
  36. //----------CAN I TAKE THIS TABLE OUT OR WAS THIS JUST TO ECHO AND SEE IF IT WORKS..I DONT NEED ANY OF
  37.  
  38. //---THESE TABLES I'LL FORMAT IT IN DREAMWEAVER BUT CAN U SHOW ME HOW TO JUST GET THE RESULTS WITH THE
  39.  
  40. //----PHP ICON SO I CAN JUST POSITION THEM IN DREAMWEAVER...THANKS...
  41.  
  42. echo "<TABLE BORDER=1 align=center>";
  43.  
  44. echo "<TD>First Name</TD><TD>Last Name</TD><TD>Street Address</TD><TD>City</TD><TD>State</TD><TR>";
  45.  
  46. echo "<td>".$VN."</td><td>".$AC."</td><td>".$AG."</td>";
  47.  
  48. echo "<td>".$City."</td><td>".$State."</td>";
  49.  
  50. echo "</TR></table><p>";
  51.  
  52. //---------------------------------------------------------------------------------------------
  53.  
  54.  
  55.  
  56. mysql_select_db ($dbname);
  57.  
  58. $mysql_mylink = mysql_pconnect($HostID, $UserID, $PassID);
  59.  
  60. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  61.  
  62. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>Street Address</TD><TD>city</TD><TD>state</TD>";
  63.  
  64. $querystring = "select * from '$Table'";
  65.  
  66. if ($VN != "" && $AC != "" && $AG != "") {$querystring = $guerystring + "where (venuename like '%$VN%') and (areacode like '%$AC%') and (agegroup like '%$AG%')";}
  67.  
  68. if ($VN != "" && $AC != "" && $AG == "") {$querystring = $guerystring + "where (venuename like '%$VN%') and (areacode like '%$AC%')";}
  69.  
  70. if ($VN != "" && $AC == "" && $AG == "") {$querystring = $guerystring + "where (venuename like '%$VN%')";}
  71.  
  72. if ($VN != "" && $AC == "" && $AG != "") {$querystring = $guerystring + "where (venuename like '%$VN%') and (agegroup like '%$AG%')";}
  73.  
  74. $SearchMatch = mysql_query ($querystring);
  75.  
  76. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  77.  
  78.    do{
  79.  
  80.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  81.  
  82.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  83.  
  84.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  85.  
  86. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  87.  
  88. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  89.  
  90. echo "</table>";
  91.  
  92. mysql_free_result($SearchMatch);
  93.  
  94. ?>
  95.  
  96.  
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 8th, 2005, 9:18 pm

  • gunman
  • Born
  • Born
  • No Avatar
  • Joined: Aug 04, 2005
  • Posts: 4
  • Status: Offline

Post August 9th, 2005, 3:01 pm

Hi i think that problems come with where clause in your source:
Try to change code to "where" clause with this one:

//old source

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%')";}

//new source

if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}

if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}

if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 9th, 2005, 10:41 pm

naw that didnt work still doing the same thing anymore advise
please dont give up on me now
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2387
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 10th, 2005, 12:30 am

Replace the single quotes (') surrounding the table name in the $querystring variable with slanted quotes (` - sorry, I don't know their proper name :lol: ), i.e.:
PHP Code: [ Download ] [ Select ]
$querystring = "select * from '$Table'";

Should become:
PHP Code: [ Download ] [ Select ]
$querystring = "select * from `$Table`";


Only string literals should be enclosed by single quotes. Database names, table names and column names should all be enclosed by slanted quote marks.
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 10th, 2005, 1:20 am

iight this is the new code:
still does the same did anyone actually test the code first....


PHP Code: [ Download ] [ Select ]
 
<?php
 
$VN = $_POST[venuename];
 
$AC = $_POST[areacode];
 
$AG = $_POST[agegroup];
 
 
 
//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
 
$VT = $_POST[venuetype];
 
$MT = $_POST[musictype];
 
//-----------------------------------------------------
 
 
 
 
 
$mysql_mylink = mysql_pconnect(localhost, nightsp, babystuff) or die(mysql_error());
 
mysql_select_db (nightsp_nightspotz) or die(mysql_error());
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
 
$querystring = "select * from venues";
 
if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}
 
 
 
if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}
 
 
 
if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
 
 
 
 
 
$SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $VN = $_POST[venuename];
  5.  
  6. $AC = $_POST[areacode];
  7.  
  8. $AG = $_POST[agegroup];
  9.  
  10.  
  11.  
  12. //-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
  13.  
  14. $VT = $_POST[venuetype];
  15.  
  16. $MT = $_POST[musictype];
  17.  
  18. //-----------------------------------------------------
  19.  
  20.  
  21.  
  22.  
  23.  
  24. $mysql_mylink = mysql_pconnect(localhost, nightsp, babystuff) or die(mysql_error());
  25.  
  26. mysql_select_db (nightsp_nightspotz) or die(mysql_error());
  27.  
  28. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  29.  
  30. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
  31.  
  32. $querystring = "select * from venues";
  33.  
  34. if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}
  35.  
  36.  
  37.  
  38. if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}
  39.  
  40.  
  41.  
  42. if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
  43.  
  44.  
  45.  
  46.  
  47.  
  48. $SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
  49.  
  50. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  51.  
  52.    do{
  53.  
  54.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  55.  
  56.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  57.  
  58.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  59.  
  60. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  61.  
  62. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  63.  
  64. echo "</table>";
  65.  
  66. mysql_free_result($SearchMatch);
  67.  
  68. ?>
  69.  
  70.  
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2387
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 10th, 2005, 1:32 am

Well, I just tested the code you posted above and it works fine for me (by fine I mean I received no errors). Obviously I had to use my own database and tables etc, but the syntax remained the same. One thing about the code in you last post though:
PHP Code: [ Download ] [ Select ]
mysql_pconnect(localhost, nightsp, babystuff)

Should be:
PHP Code: [ Download ] [ Select ]
mysql_pconnect("localhost", "nightsp", "babystuff")
Either that or setup some variables to hold the connection details, and pass them through (as in the first block of code you posted).
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 10th, 2005, 2:04 am

now i get this 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

and here' my code:
PHP Code: [ Download ] [ Select ]
 
<?php
 
$VN = $_POST[venuename];
 
$AC = $_POST[areacode];
 
$AG = $_POST[agegroup];
 
 
 
//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
 
$VT = $_POST[venuetype];
 
$MT = $_POST[musictype];
 
//-----------------------------------------------------
 
 
 
 
 
$mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
 
mysql_select_db (nightsp_nightspotz) or die(mysql_error());
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
 
$querystring = "select * from venues";
 
if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}
 
 
 
if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}
 
 
 
if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
 
 
 
 
 
$SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $VN = $_POST[venuename];
  5.  
  6. $AC = $_POST[areacode];
  7.  
  8. $AG = $_POST[agegroup];
  9.  
  10.  
  11.  
  12. //-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
  13.  
  14. $VT = $_POST[venuetype];
  15.  
  16. $MT = $_POST[musictype];
  17.  
  18. //-----------------------------------------------------
  19.  
  20.  
  21.  
  22.  
  23.  
  24. $mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
  25.  
  26. mysql_select_db (nightsp_nightspotz) or die(mysql_error());
  27.  
  28. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  29.  
  30. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
  31.  
  32. $querystring = "select * from venues";
  33.  
  34. if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}
  35.  
  36.  
  37.  
  38. if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}
  39.  
  40.  
  41.  
  42. if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
  43.  
  44.  
  45.  
  46.  
  47.  
  48. $SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
  49.  
  50. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  51.  
  52.    do{
  53.  
  54.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  55.  
  56.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  57.  
  58.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  59.  
  60. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  61.  
  62. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  63.  
  64. echo "</table>";
  65.  
  66. mysql_free_result($SearchMatch);
  67.  
  68. ?>
  69.  
  70.  
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2387
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 10th, 2005, 2:11 am

You'll need to put quotes around the variables that you are trying to access in the POST array. Also, you'll need to put quotes around the value passed to the "mysql_select_db" function.

I.E.:
PHP Code: [ Download ] [ Select ]
<?php
 
$VN = $_POST["venuename"];
 
$AC = $_POST["areacode"];
 
$AG = $_POST["agegroup"];
 
 
 
//-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
 
$VT = $_POST["venuetype"];
 
$MT = $_POST["musictype"];
 
//-----------------------------------------------------
 
 
 
 
 
$mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
 
mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
 
$querystring = "select * from venues";
 
if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}
 
 
 
if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}
 
 
 
if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
 
 
 
 
 
$SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);
 
?>
  1. <?php
  2.  
  3. $VN = $_POST["venuename"];
  4.  
  5. $AC = $_POST["areacode"];
  6.  
  7. $AG = $_POST["agegroup"];
  8.  
  9.  
  10.  
  11. //-----HOW DO I ADD THESE TO VARIBLES TO THE QUERY FROM MY SEARCH FORM---------
  12.  
  13. $VT = $_POST["venuetype"];
  14.  
  15. $MT = $_POST["musictype"];
  16.  
  17. //-----------------------------------------------------
  18.  
  19.  
  20.  
  21.  
  22.  
  23. $mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
  24.  
  25. mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
  26.  
  27. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  28.  
  29. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
  30.  
  31. $querystring = "select * from venues";
  32.  
  33. if ($VN !="") {$querystring = $guerystring + "where (venuename like '%$VN%') ";}
  34.  
  35.  
  36.  
  37. if ($AC !="") {$querystring = $guerystring + "and (areacode like '%$AC%') ";}
  38.  
  39.  
  40.  
  41. if ($AG!="") {$querystring = $guerystring + "and (agegroup like '%$AG%')";}
  42.  
  43.  
  44.  
  45.  
  46.  
  47. $SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
  48.  
  49. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  50.  
  51.    do{
  52.  
  53.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  54.  
  55.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  56.  
  57.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  58.  
  59. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  60.  
  61. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  62.  
  63. echo "</table>";
  64.  
  65. mysql_free_result($SearchMatch);
  66.  
  67. ?>
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 10th, 2005, 2:27 am

i just cut and pasted the code u put up and i'm still getting the same error message.....
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2387
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 10th, 2005, 2:33 am

OK, echo out the querystring and post what it says. To do this, add the line:
PHP Code: [ Download ] [ Select ]
echo $querystring;

just before you perform the "mysql_query".
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 10th, 2005, 2:41 am

i get the same error message
i added it like this right:

PHP Code: [ Download ] [ Select ]
 
<?php
 
$venuename = $_POST["venuename"];
 
$areacode = $_POST["areacode"];
 
$agegroup = $_POST["agegroup"];
 
$venuetype = $_POST["venuetype"];
 
$musictype = $_POST["musictype"];
 
 
 
//--------------connection and query---------------
 
 
 
$mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
 
mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
 
echo $querystring;
 
$querystring = "select * from venues";
 
if ($venuename !="") {$querystring = $guerystring + "where (venuename like '%$venuename%') ";}
 
if ($areacode !="") {$querystring = $guerystring + "and (areacode like '%$areacode%') ";}
 
if ($agegroup!="") {$querystring = $guerystring + "and (agegroup like '%$agegroup%')";}
 
if ($venuetype!="") {$querystring = $guerystring + "and (venuetype like '%$venuetype%')";}
 
if ($musictype!="") {$querystring = $guerystring + "and (musictype like '%$musictype%')";}
 
 
 
//--------------start output-------------
 
 
 
$SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $venuename = $_POST["venuename"];
  5.  
  6. $areacode = $_POST["areacode"];
  7.  
  8. $agegroup = $_POST["agegroup"];
  9.  
  10. $venuetype = $_POST["venuetype"];
  11.  
  12. $musictype = $_POST["musictype"];
  13.  
  14.  
  15.  
  16. //--------------connection and query---------------
  17.  
  18.  
  19.  
  20. $mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
  21.  
  22. mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
  23.  
  24. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  25.  
  26. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
  27.  
  28. echo $querystring;
  29.  
  30. $querystring = "select * from venues";
  31.  
  32. if ($venuename !="") {$querystring = $guerystring + "where (venuename like '%$venuename%') ";}
  33.  
  34. if ($areacode !="") {$querystring = $guerystring + "and (areacode like '%$areacode%') ";}
  35.  
  36. if ($agegroup!="") {$querystring = $guerystring + "and (agegroup like '%$agegroup%')";}
  37.  
  38. if ($venuetype!="") {$querystring = $guerystring + "and (venuetype like '%$venuetype%')";}
  39.  
  40. if ($musictype!="") {$querystring = $guerystring + "and (musictype like '%$musictype%')";}
  41.  
  42.  
  43.  
  44. //--------------start output-------------
  45.  
  46.  
  47.  
  48. $SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
  49.  
  50. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  51.  
  52.    do{
  53.  
  54.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  55.  
  56.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  57.  
  58.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  59.  
  60. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  61.  
  62. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  63.  
  64. echo "</table>";
  65.  
  66. mysql_free_result($SearchMatch);
  67.  
  68. ?>
  69.  
  70.  
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2387
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 10th, 2005, 2:52 am

But does the query get outputted to the screen before the error message? I want to see the SQL that you are trying to execute. Change your code to the following:

PHP Code: [ Download ] [ Select ]
<?php
 
$venuename = $_POST["venuename"];
 
$areacode = $_POST["areacode"];
 
$agegroup = $_POST["agegroup"];
 
$venuetype = $_POST["venuetype"];
 
$musictype = $_POST["musictype"];
 
 
 
//--------------connection and query---------------
 
 
 
$mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
 
mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
 
 
 
$querystring = "select * from venues";
 
if ($venuename !="") {$querystring = $guerystring + "where (venuename like '%$venuename%') ";}
 
if ($areacode !="") {$querystring = $guerystring + "and (areacode like '%$areacode%') ";}
 
if ($agegroup!="") {$querystring = $guerystring + "and (agegroup like '%$agegroup%')";}
 
if ($venuetype!="") {$querystring = $guerystring + "and (venuetype like '%$venuetype%')";}
 
if ($musictype!="") {$querystring = $guerystring + "and (musictype like '%$musictype%')";}
 
 
 
//--------------start output-------------
 
echo $querystring;
 
/*
 
$SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);*/
 
?>
  1. <?php
  2.  
  3. $venuename = $_POST["venuename"];
  4.  
  5. $areacode = $_POST["areacode"];
  6.  
  7. $agegroup = $_POST["agegroup"];
  8.  
  9. $venuetype = $_POST["venuetype"];
  10.  
  11. $musictype = $_POST["musictype"];
  12.  
  13.  
  14.  
  15. //--------------connection and query---------------
  16.  
  17.  
  18.  
  19. $mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
  20.  
  21. mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
  22.  
  23. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  24.  
  25. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
  26.  
  27.  
  28.  
  29. $querystring = "select * from venues";
  30.  
  31. if ($venuename !="") {$querystring = $guerystring + "where (venuename like '%$venuename%') ";}
  32.  
  33. if ($areacode !="") {$querystring = $guerystring + "and (areacode like '%$areacode%') ";}
  34.  
  35. if ($agegroup!="") {$querystring = $guerystring + "and (agegroup like '%$agegroup%')";}
  36.  
  37. if ($venuetype!="") {$querystring = $guerystring + "and (venuetype like '%$venuetype%')";}
  38.  
  39. if ($musictype!="") {$querystring = $guerystring + "and (musictype like '%$musictype%')";}
  40.  
  41.  
  42.  
  43. //--------------start output-------------
  44.  
  45. echo $querystring;
  46.  
  47. /*
  48.  
  49. $SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
  50.  
  51. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  52.  
  53.    do{
  54.  
  55.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  56.  
  57.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  58.  
  59.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  60.  
  61. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  62.  
  63. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  64.  
  65. echo "</table>";
  66.  
  67. mysql_free_result($SearchMatch);*/
  68.  
  69. ?>

And then post the SQL that gets written to the screen. It should be in the form "select * from venues where ... "
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 10th, 2005, 2:57 am

it just puts out an 0 in the middle of the screen
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 07, 2004
  • Posts: 2387
  • Loc: Edinburgh, Scotland
  • Status: Offline

Post August 10th, 2005, 3:00 am

In your "if" statements, you've spelt "querystring" wrong on a number of occasions (you've spelt it "guerystring" rather than "querystring"). Change this and see if it makes a difference.
Why do geeks get Halloween and Christmas confused?
Because 31 Oct == 25 Dec
www.darren-king.co.uk
  • olm75
  • Proficient
  • Proficient
  • No Avatar
  • Joined: Aug 07, 2005
  • Posts: 293
  • Status: Offline

Post August 10th, 2005, 3:08 am

im afraid its the same

PHP Code: [ Download ] [ Select ]
 
<?php
 
$venuename = $_POST["venuename"];
 
$areacode = $_POST["areacode"];
 
$agegroup = $_POST["agegroup"];
 
$venuetype = $_POST["venuetype"];
 
$musictype = $_POST["musictype"];
 
 
 
//--------------connection and query---------------
 
 
 
$mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
 
mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
 
echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
 
echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
 
 
 
$querystring = "select * from venues";
 
if ($venuename !="") {$querystring = $querystring + "where (venuename like '%$venuename%') ";}
 
if ($areacode !="") {$querystring = $querystring + "and (areacode like '%$areacode%') ";}
 
if ($agegroup!="") {$querystring = $querystring + "and (agegroup like '%$agegroup%')";}
 
if ($venuetype!="") {$querystring = $querystring + "and (venuetype like '%$venuetype%')";}
 
if ($musictype!="") {$querystring = $querystring + "and (musictype like '%$musictype%')";}
 
 
 
//--------------start output-------------
 
echo $querystring;
 
/*
 
$SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
 
if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
 
   do{
 
      echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
 
      echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
 
      echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
 
} while($MatchRecordRow = mysql_fetch_array($SearchMatch));
 
} else {echo "<center>Sorry, No Records Were Found!</center>";}
 
echo "</table>";
 
mysql_free_result($SearchMatch);*/
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $venuename = $_POST["venuename"];
  5.  
  6. $areacode = $_POST["areacode"];
  7.  
  8. $agegroup = $_POST["agegroup"];
  9.  
  10. $venuetype = $_POST["venuetype"];
  11.  
  12. $musictype = $_POST["musictype"];
  13.  
  14.  
  15.  
  16. //--------------connection and query---------------
  17.  
  18.  
  19.  
  20. $mysql_mylink = mysql_pconnect("localhost", "nightsp", "babystuff") or die(mysql_error());
  21.  
  22. mysql_select_db ("nightsp_nightspotz") or die(mysql_error());
  23.  
  24. echo "<TABLE class='sortable' id='Identify' BORDER=1 align=center>";
  25.  
  26. echo "<TD>VENUENAME</TD><TD>AREACODE</TD><TD>AGE GROUP</TD><TD>CITY</TD><TD>STATE</TD>";
  27.  
  28.  
  29.  
  30. $querystring = "select * from venues";
  31.  
  32. if ($venuename !="") {$querystring = $querystring + "where (venuename like '%$venuename%') ";}
  33.  
  34. if ($areacode !="") {$querystring = $querystring + "and (areacode like '%$areacode%') ";}
  35.  
  36. if ($agegroup!="") {$querystring = $querystring + "and (agegroup like '%$agegroup%')";}
  37.  
  38. if ($venuetype!="") {$querystring = $querystring + "and (venuetype like '%$venuetype%')";}
  39.  
  40. if ($musictype!="") {$querystring = $querystring + "and (musictype like '%$musictype%')";}
  41.  
  42.  
  43.  
  44. //--------------start output-------------
  45.  
  46. echo $querystring;
  47.  
  48. /*
  49.  
  50. $SearchMatch = mysql_query ($querystring, $mysql_mylink) or die(mysql_error());
  51.  
  52. if ($MatchRecordRow = mysql_fetch_array($SearchMatch)) {
  53.  
  54.    do{
  55.  
  56.       echo "<TR><td>".$MatchRecordRow['venuename']."</TD>";
  57.  
  58.       echo "<td>".$MatchRecordRow['areacode']."</TD><td>".$MatchRecordRow['agegroup']."</TD>";
  59.  
  60.       echo "<td>".$MatchRecordRow['city']."</TD><td>".$MatchRecordRow['state']."</TD>";
  61.  
  62. } while($MatchRecordRow = mysql_fetch_array($SearchMatch));
  63.  
  64. } else {echo "<center>Sorry, No Records Were Found!</center>";}
  65.  
  66. echo "</table>";
  67.  
  68. mysql_free_result($SearchMatch);*/
  69.  
  70. ?>
  71.  
  72.  
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 10th, 2005, 3:08 am

Post Information

  • Total Posts in this topic: 42 posts
  • Users browsing this forum: No registered users and 219 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.