npsari Posted October 17, 2007 Share Posted October 17, 2007 Hi there, I use this to count repeats from database $q = "SELECT SENDER COUNT(SENDER) as CNT FROM profile GROUP BY SENDER ORDER BY CNT DESC LIMIT 20;"; then i echo data... while($row = mysql_fetch_array($result)){ echo "$row[CNT]"; echo "<a href='/one.php?ID={$row['SENDER_PROFILE']}' target='_blank'>$row[sENDER_PROFILE]</a>"; } But the quesry to show only the rows where ImageName and Email are not empty i.e. WHERE Image !='' AND Email !='' How can i add this part to the query? can you show me guys please, cus when i add it, i add it wrong Link to comment https://forums.phpfreaks.com/topic/73709-solved-mysql-hustle-but-i-think-it-is-easy/ Share on other sites More sharing options...
hostfreak Posted October 17, 2007 Share Posted October 17, 2007 Should do the trick $q = "SELECT SENDER COUNT(SENDER) as CNT FROM profile WHERE ImageName != '' AND Email != '' GROUP BY SENDER ORDER BY CNT DESC LIMIT 20"; Link to comment https://forums.phpfreaks.com/topic/73709-solved-mysql-hustle-but-i-think-it-is-easy/#findComment-371919 Share on other sites More sharing options...
npsari Posted October 17, 2007 Author Share Posted October 17, 2007 wow, cool, solved it out thanks hostfreak Link to comment https://forums.phpfreaks.com/topic/73709-solved-mysql-hustle-but-i-think-it-is-easy/#findComment-371921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.