Counting Row By Specific User And Limit!
Posted: Thu Nov 20, 2008 3:20 pm
i need to count the results sent by users ,i need a code to start counting results and find me results from the same user ,i want to be able to limit results by user ,i want to limit the user to maximum 4 rows in a run if it reaches 5 rows the result number 5 will be deleted or something !
this is my example code fo geting the results:
select * from my table where username=$username and bidprice=$bid_price order by bid_price desc
like this situation is good: 4 result from the same user then user 2 is between ,the result 5 from user 1 ,user 1 can continue to post more and have 4 rows in a run again!!
user1
user1
user1
user1
user2 <===== there is one result between user1 so its ok
user1
and this way is not good:
user1
user1
user1
user1
user1 <===== there is 5 result from user1 so result No. 5 will be deleted
user2
thanx
this is my example code fo geting the results:
select * from my table where username=$username and bidprice=$bid_price order by bid_price desc
like this situation is good: 4 result from the same user then user 2 is between ,the result 5 from user 1 ,user 1 can continue to post more and have 4 rows in a run again!!
user1
user1
user1
user1
user2 <===== there is one result between user1 so its ok
user1
and this way is not good:
user1
user1
user1
user1
user1 <===== there is 5 result from user1 so result No. 5 will be deleted
user2
thanx