Jump to content


Photo

help with a query


  • Please log in to reply
3 replies to this topic

#1 adamdidthis

adamdidthis
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 13 March 2006 - 12:34 PM

I have the following query:

$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);

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:

$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);

But it still doesn't work, any idea whats wrong?

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 13 March 2006 - 02:31 PM

Is it producing an error or just not returning data?

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

#3 Masna

Masna
  • Staff Alumni
  • Advanced Member
  • 288 posts
  • LocationNew York

Posted 13 March 2006 - 02:35 PM

[!--quoteo(post=354475:date=Mar 13 2006, 12:34 PM:name=adamdidthis)--][div class=\'quotetop\']QUOTE(adamdidthis @ Mar 13 2006, 12:34 PM) View Post[/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.
I like LoL.

#4 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 14 March 2006 - 12:27 AM

[!--quoteo(post=354502:date=Mar 13 2006, 08:35 AM:name=Masna)--][div class=\'quotetop\']QUOTE(Masna @ Mar 13 2006, 08:35 AM) View Post[/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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users