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 ? Link to comment https://forums.phpfreaks.com/topic/59583-php-help/ 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? Link to comment https://forums.phpfreaks.com/topic/59583-php-help/#findComment-296045 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? Link to comment https://forums.phpfreaks.com/topic/59583-php-help/#findComment-296047 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; } } } } } Link to comment https://forums.phpfreaks.com/topic/59583-php-help/#findComment-296051 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... Link to comment https://forums.phpfreaks.com/topic/59583-php-help/#findComment-296054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.