![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Does anyone know why I am getting the message 'Query was empty' I get this 'Query was empty' after inserting code line //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']); } // 2 mysql_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); // 3 if ($HTTP_POST_VARS['radType']=='AND') { $query_rsResults = sprintf("SELECT mdbTable.AlbumName, mdbTable.AlbumArtist, mdbTable.Keywords FROM mdbTable WHERE mdbTable.AlbumName LIKE '%%%s%%' AND mdbTable.AlbumArtist LIKE '%%%s%%' AND mdbTable.Keywords LIKE '%%%s%%'", $txtTitle_rsResults,$txtArtist_rsResults,$txtKeywo rds_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 ?> | |||
| Featured Websites | ||||
|
![]() |
| Tags: code, help, mysql, php, search |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MySQL Query Cache Not Working: MySQL 5 / Windows XP | Good Man | Database | 0 | 05-31-2007 8:46 PM |
| Query Major Search Engines For Search Engine Position | caphonic@gmail.com | Website Reviews And Website Questions | 1 | 05-28-2007 12:44 AM |
| Featured Websites | ||||
|