Jump to content

Search engine suddenly not working?


MDanz

Recommended Posts

I changed some values of results in phpmyadmin and now the search engine doesn't work. It just displays no results found.    The code is correct i'm sure, what could be wrong? 

 

<?php
//get data




$button = $_GET['submit'];
$search = $_GET['search'];

if

(!$button)
   echo "You didn't submit a keyword";
   
   else
   {
   if(!isset($search) ||  strlen($search)<=2)
   echo "<br><font color=white>search term too short</font>";
      else
      {
      echo "<br><br><font color=white>you searched for <b>$search</b></font><hr size='1'>";
      }
      mysql_connect("localhost", "Master", "password");
      mysql_select_db("Login");
      

      //explode our search term
      $search_exploded = explode(" ",$search);
      foreach($search_exploded as $search_each)
      {
      //construct query
      $x++;
      if($x==1)
               $construct .= "keywords LIKE '$search_each'";
               else
               $construct .= "OR keywords LIKE '$search_each'";
      }
      
                  //echo out $construct
      $construct = "SELECT * FROM Upload WHERE $construct";
}              $run = mysql_query($construct);
                $foundnum =  mysql_num_rows($run);

if  ($foundnum==0)
echo "<br><br><font color=white>No Stacks Found</font>";
else
{
     echo "<font color=white>$foundnum Stacks Found!</font><p>";
if($_GET['RadioGroup1']== 1 )
$margin = 'style="margin-left:60px"';
else if($_GET['RadioGroup1']== 2 )
$margin = 'style="margin-left:120px"';
else if($_GET['RadioGroup1']== 3 )
$margin = 'style="margin-left:180px"';
else if($_GET['RadioGroup1']== 4 )
$margin = 'style="margin-left:240px"';
else if($_GET['RadioGroup1']== 5 )
$margin = 'style="margin-left:300px"';
else if($_GET['RadioGroup1']== 6 )
$margin = 'style="margin-left:360px"';
else if($_GET['RadioGroup1']== 7 )
$margin = 'style="margin-left:420px"';
else if($_GET['RadioGroup1']== 8 )
$margin = 'style="margin-left:480px"';
else
$margin = 'style="margin-left:0px"';
echo '<table '.$margin.'>';

       while ($runrows = mysql_fetch_assoc($run))
     {
              //get data
        $name = $runrows['name'];
        $image = $runrows['image'];
        $hyperlink = $runrows['hyperlink'];
        $currency = $runrows['currency'];
        $info = $runrows['info'];
        $type = $runrows['type'];



        echo '<tr><td>';
switch ($type) {
    case 'I':
        echo '<img src="http://www.u-stack.com/Image.jpg">';
        break;
    case 'M':
        echo '<img src="http://www.u-stack.com/Music.jpg">';
        break;
    case 'F':
        echo '<img src="http://www.u-stack.com/File.jpg">';
        break;
    case 'V':
        echo '<img src="http://www.u-stack.com/Video.jpg">';
        break;
         case 'J':
        echo '<img src="http://www.u-stack.com/Job.jpg">';
        break;
         case 'D':
        echo '<img src="http://www.u-stack.com/Discussion.jpg">';
        break;
         case 'P':
        echo '<img src="http://www.u-stack.com/Product.jpg">';
        break;



}   echo '</td></tr>';



     }
     
     
     echo '</table>';
}

?>

Link to comment
https://forums.phpfreaks.com/topic/169863-search-engine-suddenly-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.