Jump to content


Photo

help with my Mysql search code


  • Please log in to reply
No replies to this topic

#1 oavs

oavs
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts
  • LocationDownunder

Posted 10 July 2003 - 01:51 AM

Does anyone know why I am getting the message \'Query was empty\'
I get this \'Query was empty\' after inserting code line //3
Also my record set dissappearing from the DW MX server behavior window after the code marked //3.



<?php require_once(\'../Connections/connMDB.php\'); ?><?php// 1$txtKeywords_rsResults = "myKeywords";if (isset($HTTP_POST_VARS[\'txtKeywords\'])) {  $txtKeywords_rsResults = (get_magic_quotes_gpc()) ?$HTTP_POST_VARS[\'txtKeywords\'] : addslashes($HTTP_POST_VARS[\'txtKeywords\']);}$txtArtist_rsResults = "myArtist";if (isset($HTTP_POST_VARS[\'txtArtist\'])) {  $txtArtist_rsResults = (get_magic_quotes_gpc()) ?$HTTP_POST_VARS[\'txtArtist\'] : addslashes($HTTP_POST_VARS[\'txtArtist\']);}$txtTitle_rsResults = "myTitle";if (isset($HTTP_POST_VARS[\'txtTitle\'])) {  $txtTitle_rsResults = (get_magic_quotes_gpc()) ?$HTTP_POST_VARS[\'txtTitle\'] : addslashes($HTTP_POST_VARS[\'txtTitle\']);}// 2mysql_select_db($database_connMDB, $connMDB);$rsResults = mysql_query($query_rsResults, $connMDB) or die(mysql_error());$row_rsResults = mysql_fetch_assoc($rsResults);$totalRows_rsResults = mysql_num_rows($rsResults);// 3if ($HTTP_POST_VARS[\'radType\']==\'AND\') {$query_rsResults = sprintf("SELECT mdbTable.AlbumName, mdbTable.AlbumArtist,mdbTable.Keywords FROM mdbTable WHERE mdbTable.AlbumName LIKE \'%%%s%%\' ANDmdbTable.AlbumArtist LIKE \'%%%s%%\' AND mdbTable.Keywords LIKE \'%%%s%%\'",$txtTitle_rsResults,$txtArtist_rsResults,$txtKeywords_rsResults);} else {// 4 $fieldArray = array(); // 5 if ($txtTitle_rsResults!=\'\') {  $fieldArray[count($fieldArray)] = sprintf("mdbTable.AlbumName LIKE\'%%%s%%\'",$txtTitle_rsResults);  }  if ($txtArtist_rsResults!=\'\') {  $fieldArray[count($fieldArray)] = sprintf("mdbTable.AlbumArtist LIKE\'%%%s%%\'",$txtAuthor_rsResults);  }  if ($txtKeywords_rsResults!=\'\') {  $fieldArray[count($fieldArray)] = sprintf("mdbTable.Keywords LIKE\'%%%s%%\'",$txtKeywords_rsResults);  }  // 6 $query = implode(" OR ",$fieldArray); if ($query=="") {  $query_rsResults = "SELECT * FROM mdbTable WHERE AlbumID=0"; } else { // 7  $query_rsResults = "SELECT mdbTable.AlbumName, mdbTable.AlbumArtist,mdbTable.Keywords FROM mdbTable WHERE ".$query;   }  } // 8 - end of Serach Code?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users