Jump to content

Archived

This topic is now archived and is closed to further replies.

adamdidthis

help with a query

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Is it producing an error or just not returning data?

Please print the query after all the variables have been evaluated.

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.