Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search issue

Status
Not open for further replies.

deecee

Technical User
Joined
Aug 25, 2001
Messages
1,678
Location
US
Here is mysql statement for my search_results page

Code:
mysql_select_db($database_connCorelist, $connCorelist);
$query_corelist = sprintf("SELECT * FROM products WHERE description1 LIKE '%%%s%%' OR description2 LIKE '%%%s%%' OR description3 LIKE '%%%s%%' OR description4 LIKE '%%%s%%' OR description5 LIKE '%%%s%%' OR description6 LIKE '%%%s%%' ORDER BY productid ASC", $colname_corelist,$colname_corelist,$colname_corelist,$colname_corelist,$colname_corelist,$colname_corelist);
$query_limit_corelist = sprintf("%s LIMIT %d, %d", $query_corelist, $startRow_corelist, $maxRows_corelist);
$corelist = mysql_query($query_limit_corelist, $connCorelist) or die(mysql_error());
$row_corelist = mysql_fetch_assoc($corelist);

It works fine when searching for a keyword, however when there is no result then it brings in a 1 row result with no data in it, just a broken image and a details link like there was an match but nothing came up. How can i have my search function redirect the page back to the search page if there is no result with a "There was no matches to your query" type message?

this is my php statement for the search

Code:
if (isset($HTTP_POST_VARS['description'])) {
  $colname_corelist = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['description'] : addslashes($HTTP_POST_VARS['description']);
}

BTW what is a good intro book to to php, and an intermediate book as well?

[Hammer]
Nike Failed Slogans -- "Just Don't Do It!"
 
you can find lotsa realy good books for free on filesharing networks :) there usually quite detailed and offer lots of information on a certain subject, the one im reading now is called "PHP and MySQL Web Dev.pdf"

good luck

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top