BigX Posted March 31, 2008 Share Posted March 31, 2008 Hi guys, I have put together a search engine and I have this code! <?php $string = "voor informatie"; $string = strtolower($string); $split = split(" ",$string); foreach ($split as $array => $value) { $new_string .= ''.$value.' '; } $new_string=substr($new_string,0,(strLen($new_string)-1)); $split_stemmed = split(" ",$new_string); $sql = "SELECT DISTINCT * FROM organisaties WHERE ("; while(list($key,$val)=each($split_stemmed)){ if($val<>" " and strlen($val) > 0){ $sql .= "(Organisatie LIKE '%.$val.%' OR Algemenebeschrijving LIKE '%.$val.%' OR Trefwoorden LIKE '%.$val.%') OR"; } } $sql=substr($sql,0,(strLen($sql)-3));//this will eat the last OR $sql .= ") ORDER BY id DESC"; $query = mysql_query($sql) or die(mysql_error()); $row_sql = mysql_fetch_assoc($query); $total = mysql_num_rows($query); if($total>0) { while ($row_sql = mysql_fetch_assoc($query)) { echo ''.$row_sql['Organisatie'].''; } } else { echo "No results to display"; } ?> I gives "No results to display" as a result while I know for a fact that it should give multiple results! I think there is a syntax error somewhere but I cannot find it! Thanks Link to comment https://forums.phpfreaks.com/topic/98747-help-needed-with-search-engine-syntax-error/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.