jd2007 Posted July 12, 2007 Share Posted July 12, 2007 echo $fieldvalue the above is in a loop. $fieldvalue changes every time it loops. i want to use php to see if the same $fieldvalue content is already echoed, then stop $fieldvalue from being echoed. how to do this, pls help ? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 12, 2007 Share Posted July 12, 2007 Could you post the entire code so we can see exactly what is going on? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 12, 2007 Share Posted July 12, 2007 Thats a weak method of Mysql Extraction why not search for what you want in the first place? Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 12, 2007 Author Share Posted July 12, 2007 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; } } } } } Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 12, 2007 Author Share Posted July 12, 2007 pls help me....pls rate my script... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.