deejay Posted April 14, 2003 Share Posted April 14, 2003 I am using SELECT DISTINCT any ideas on how I can get around this. If I cant do it in the mySQL query should I try and write some PHP to sort it? <?php $query =\" SELECT DISTINCT products.products_model, product_pages.title, products.products_id, product_pages.products_id, LEFT(product_pages.main_desc,300) AS description_one FROM products,product_pages WHERE product_pages.title LIKE \'%$search_keyword%\' OR products.products_model LIKE \'%$search_keyword%\' ORDER BY products.products_date_added OR product_pages.products_date_added \"; ?> and the while code I am using to call up the rows of results is <?php while ($resultRow = mysql_fetch_assoc($searchResults)) { //open3 // following if we decide which table the information is got from $title = $resultRow[\'title\']; $products_model = $resultRow[\'products_model\']; $main_desc = $resultRow[\'description_one\']; $descLength = strlen( $main_desc ); if($descLength > 5){ echo \'<tr bgcolor=\"#FFFFFF\"> <td class=\"normal\">\'.$title.\' </td> <td height=\"30\" class=\"normal\">\'.$main_desc.\'</td> <td height=\"30\" class=\"normal\"><a href=\"products.php?title=\'.$title.\'\">Click Here</a></td> </tr>\'; } elseif($products_model){ echo \'<tr bgcolor=\"#FFFFFF\"> <td class=\"normal\">\'.$products_model.\' </td> <td height=\"30\" class=\"normal\">Shopping cart page for \'.$products_model.\' </td> <td height=\"30\" class=\"normal\"><a href=\"/catalog/product_info.php?products_id=\'.$resultRow[\'products_id\'].\'\">Click Here</a></td> </tr>\'; } else echo \'\'; } //end while echo \'</table>\'; } //close 2 ?> struggling with this code badly, does anyone know of a good mySQL book as I\'m finding the documentation heavy going. Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/347-i-am-getting-multiple-returns-of-identical-searches-even-tho/ 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.