PHP Code:
PHP Code:
$slavesel = mysql_query("SELECT * FROM `slaves`");
$result = mysql_num_rows($slavesel);
$randomdel = rand(2,$result);
</div> Is some code I have for selecting the rows from a table, counting them and randomizing them between 2 and the result.
What I have after that is:
<div class="code_header">PHP Code:
PHP Code:
$delete = mysql_query("DELETE FROM slaves AMOUNT '$randomdel'");
But this doesn't work... It was a guess at it actually happening and much to my non suprisment... It didn't work. Is there anything like this that may work (Something that will delete an amount of rows randomly so instead of starting at 1 all the time it may start at row 34288 if there were that many).
I was thinking keep what I have at the top then below that have:
<div class="code_header">PHP Code:
PHP Code:
$rand2 = rand(1,$randomdel);
Then having:
<div class="code_header">PHP Code:
PHP Code:
$delete = mysql_query("DELETE FROM slaves LIMIT $rand2, $randomdel");
All help will be much appreciated!