Jump to content


Limit Mysql results


1 reply to this topic

#1 webradar

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 24 February 2008 - 05:08 PM

Hi,

What I'm trying to do is limit the rows that display with two columns. So,

SELECT `whatever` FROM `table` WHERE `id` = '2' AND `userid` = '3'

However, what I want to do is have more userids in the query, however if I did that I would have to keep adding 'id' = 2....

e.g. SELECT `whatever` FROM `table` WHERE `id` = '2' AND `userid` = '3' OR `id` = '2' AND `userid` = '5' OR `id` = '2' AND `userid` = '8'

Is there any different way of doing this as it would be different for each member of my site and some people would have many friends - which would presumably slow down the query.

What I want is it to grab that row from the database (which is the id), but needs to check that it has been sent from only his/her friends (which is the userid) - so whether i need to do it by php aswell

I seem to be having a mental block of what to do, so I'd be grateful if somebody could give me a little help please! =)

Thanks!

Edited by webradar, 24 February 2008 - 06:54 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 24 February 2008 - 07:40 PM

Closed per request.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users