Jump to content

php help ?


jd2007

Recommended Posts

if (!$n) {
   include("search.php");
   echo "No search term given"; 
}
else    {
   $name=explode(" ", $n);
   $namelen=count($name);
   
   
   if ($namelen == 1) {
      $db = mysql_connect("localhost", "root");
      $connection=mysql_select_db("Search", $db);
      $query = "SELECT Searching.tags, Searching.page_title, Searching.info, Searching.link
	FROM Searching WHERE tags LIKE'%".$n."%'";
      $result = mysql_query($query);
      if (mysql_num_rows($result) == 0) {
	echo "Sorry, no matching results.";
	echo $link;
	exit;
      }		
      while ($record = mysql_fetch_assoc($result)) {
	while (list($fieldname, $fieldvalue) = each ($record)) {
		echo $fieldvalue."<BR>";
	}
	echo "<BR>";


   }
} else if ($namelen > 1) {
          
          $db = mysql_connect("localhost", "root");
          $connection=mysql_select_db("Search", $db);
          $i=$namelen;
          for ($j=0; $j<$i; $j++) {
           $query = "SELECT Searching.page_title, Searching.info, Searching.link
	FROM Searching WHERE info LIKE'%".$name[$j]."%'";
      $result = mysql_query($query);
      if (mysql_num_rows($result) == 0) {


	//echo "<br>";
      }	
      	
      while ($record = mysql_fetch_assoc($result)) {
	while (list($fieldname, $fieldvalue) = each ($record)) {
	       for ($l=0; $l<count($name); $l++) {
	       $old = array($name[$l]);
                       $new = array("<b><u>".$name[$l]."</u></b>");
                       $fieldvalue = str_replace($old, $new, $fieldvalue);
                       
                      
                       }
                          echo  $fieldvalue;
                }
                       
                       
	          
	          
	          }
	          




   }
          
          }
          
   }

Link to comment
https://forums.phpfreaks.com/topic/59583-php-help/#findComment-296051
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.