adamdidthis Posted March 13, 2006 Share Posted March 13, 2006 I have the following query:[code]$sql2=$dbconn->SelectLimit($test = "SELECT u.user_id, u.username, u.user_lastvisit, u.user_regdate, u.user_aim, u.user_yim, u.user_msnm, u.user_email, u.user_viewemail, $postplace, u.user_rank, u.user_from, u.user_occ, u.user_interests, u.user_avatar, u.user_avatar_type FROM $pntable[phpbb_users] AS u LEFT JOIN $pntable[phpbb_posts] p ON u.user_id=p.poster_i d GROUP BY u.user_id ORDER BY $order DESC", 1);[/code]And would like to make it so that it only returns a result if there is something in the u.user_avater column.So I have tried this:[code]$sql2=$dbconn->SelectLimit($test = "SELECT u.user_id, u.username, u.user_lastvisit, u.user_regdate, u.user_aim, u.user_yim, u.user_msnm, u.user_email, u.user_viewemail, $postplace, u.user_rank, u.user_from, u.user_occ, u.user_interests, u.user_avatar, u.user_avatar_type FROM $pntable[phpbb_users] AS u LEFT JOIN $pntable[phpbb_posts] p ON u.user_id=p.poster_i d WHERE u.user_avatar != "" GROUP BY u.user_id ORDER BY $order DESC", 1);[/code]But it still doesn't work, any idea whats wrong? Quote Link to comment https://forums.phpfreaks.com/topic/4823-help-with-a-query/ Share on other sites More sharing options...
wickning1 Posted March 13, 2006 Share Posted March 13, 2006 Is it producing an error or just not returning data?Please print the query after all the variables have been evaluated. Quote Link to comment https://forums.phpfreaks.com/topic/4823-help-with-a-query/#findComment-16985 Share on other sites More sharing options...
Masna Posted March 13, 2006 Share Posted March 13, 2006 [!--quoteo(post=354475:date=Mar 13 2006, 12:34 PM:name=adamdidthis)--][div class=\'quotetop\']QUOTE(adamdidthis @ Mar 13 2006, 12:34 PM) [snapback]354475[/snapback][/div][div class=\'quotemain\'][!--quotec--]And would like to make it so that it only returns a result if there is something in the u.user_avater column.[/quote]That's not really necessary. Just process the results with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/4823-help-with-a-query/#findComment-16986 Share on other sites More sharing options...
wickning1 Posted March 14, 2006 Share Posted March 14, 2006 [!--quoteo(post=354502:date=Mar 13 2006, 08:35 AM:name=Masna)--][div class=\'quotetop\']QUOTE(Masna @ Mar 13 2006, 08:35 AM) [snapback]354502[/snapback][/div][div class=\'quotemain\'][!--quotec--]That's not really necessary. Just process the results with PHP.[/quote]Bad advice. You should never return more data from MySQL than you are going to use. Quote Link to comment https://forums.phpfreaks.com/topic/4823-help-with-a-query/#findComment-17201 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.