iceflyin
11-15-2007, 03:03 PM
How do I reset the indexes on a table?
Because... I assume that with index skips, eg... 4-5-7-8-12... Where stuff got deleted. This code here might become inefficient?
$gotConf = false;
while ($gotConf == false){
$confData = mysql_query("SELECT * FROM confession WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM confession) AND active=1 ORDER BY id LIMIT 1;", $conn) or die ('Confession select failed');
$confInfo = mysql_fetch_array($confData);
if (isset($confInfo[text]{2})){
$gotConf= true;
}
}
Because... I assume that with index skips, eg... 4-5-7-8-12... Where stuff got deleted. This code here might become inefficient?
$gotConf = false;
while ($gotConf == false){
$confData = mysql_query("SELECT * FROM confession WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM confession) AND active=1 ORDER BY id LIMIT 1;", $conn) or die ('Confession select failed');
$confInfo = mysql_fetch_array($confData);
if (isset($confInfo[text]{2})){
$gotConf= true;
}
}