HELP!!!!!

Hey Everyone, Thank you so much in advance for the assistance. I have a website Rayskitchen.com. I had to update my php version on the server from 4.4.6 to 5.2.13 I think, and when I did I lost my search ability on my website.

My site will enter the search but will only return " Sorry, but we can not find an entry
to match your query".

Can someone please take a look at my code and possibly tell me what’s wrong with it? I’m pulling my hair out what little of it I have left.

Thank you Ray… Also I’m pretty stupid when it comes to php so please respond like you’re talking to someone in kindergarden. (step by step please :slight_smile: )

Here’s the code.

Form Code:

Here is the php code:

<? //step1 make sure the pageno variable is always on the current page if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if //This is only displayed if they have submitted the form if ($searching =="yes" | $pageno >= 1) { //If they did not enter a search term we give them an error if ($find == "" && $searching =="yes") { echo "You forgot to enter a search term"; exit; } elseif ($find <> "" && $searching =="yes") { $tofind = $find; } // Otherwise we connect to our Database mysql_connect("localhost", "******", "******") or die(mysql_error()); mysql_select_db("recipe") or die(mysql_error()); // We preform a bit of filtering $tofind = strtoupper($tofind); $tofind = strip_tags($tofind); $tofind = trim($tofind); //step2 (for pagination) - always know the total number of rows for the current query's //result set $query_count = "SELECT count(*) as totalrows FROM $field WHERE MATCH(title,category, ingredients) AGAINST ('$tofind')"; $data = mysql_query($query_count); $result = mysql_fetch_array($data); $totalrows = $result['totalrows']; //step2 (for pagination) variables for pagination are initialized //$limit is the results to display per page $limit = 5 ; $lastpage = ceil($totalrows /$limit); $pageno = (int)$pageno; if ($pageno < 1) { $pageno = 1; } elseif ($pageno > $lastpage) { $pageno = $lastpage; } // if $limitvalue = 'LIMIT ' .($pageno - 1) * $limit .',' .$limit; //step3 Now we search for our search term, in the field the user specified //use the LIMIT sql operator to control "segments" of the result set to return $current_query = "SELECT * FROM $field WHERE MATCH(title,category, ingredients) AGAINST ('$tofind') $limitvalue"; $data = mysql_query($current_query); $numrows = mysql_num_rows($data); if ($numrows == 0) { echo "Sorry, but we can not find an entry
to match your query"; } // keeps getting the next row until there are no more to get while($result = mysql_fetch_array( $data )) { // Print out the contents of each row into a table echo ""; echo "

"; echo "
"; echo "
"; echo ""; //echo ""; echo ""; } //add a congruent table onto the last record on the page with the pagination navigation echo "
"; echo "  Category:  "; echo $result['category']; echo "     ID #:  "; echo $result['id']; echo "
"; echo "
"; echo $result['title']; echo "
"; echo "
Ingredients: "; echo "

"; echo nl2br($result['ingredients']); echo "
"; echo "
"; echo "
Directions: "; echo "

"; echo nl2br($result['directions']); echo "
"; echo "</font

Print Recipes By Clicking Above


Print Recipe
"; echo "

"; echo ""; echo "
"; if ($pageno == 1) { echo " FIRST PREV "; } else { echo " FIRST "; $prevpage = $pageno-1; echo " PREV "; } // if echo " ( Page $pageno of $lastpage ) "; if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo " NEXT "; echo " LAST "; } // if echo "
"; mysql_free_result($data); echo "
"; echo ""; //And we remind them what they searched for echo "Searched For:" .$tofind; echo "
"; echo "Refine your search to get better results."; echo ""; } ?>

In your code you rely on register_globals = On (in php.ini). For a quick fix, try to add this at top of your php script that process submitted search form:

[php]
extract($_REQUEST);
[/php]

But this is potentially not safe, same as using register_globals On.

THANK YOU!!! THANK YOU!!! THANK YOU!!! That worked perfectly!

Sponsor our Newsletter | Privacy Policy | Terms of Service