ok , i got this code for limiting users for max 9 records in the first 50 rows .
i want to my code to check only in the first 50 rows .
now if i got lets say 70 rows ,the SELECT limit is not working , it starting from row 70 ,and i need it to look only in the 50 first rows.
if you got 10 rows from the same user ,the last record will be updated to be bad! (over the rule)
my quastion is how can i force this limit to look only in the first 50 rows ,so if a user have 9 rows in the first 50 is ok ,and if he got more rows
from 50 to 70 it's ok then!
$query = mysql_query("SELECT reg_id FROM `bidding_details` where bid_id='$bid_id' and sortbid = '1' and username='$username' limit 50") or die(mysql_error());
$last = '';
$count = 0;
while($line = mysql_fetch_assoc($query)) {
if($last == $line['reg_id']) $count++;
else {
$last = $line['reg_id'];
$count = 1;
}
if($count > 9) {
$sql_delete="update bidding_details set sortbid = '0' ,rank = '0' where bid_id='$bid_id' and username='$username' and sortbid = '1' order by bid_price asc limit 1";
mysql_query($sql_delete)or die(mysql_error());
}
}