jeromepelletier
05-24-2006, 10:48 PM
I have:
PHP Code:
$selectinputslimit=0;
$selectinputs="EXPLAIN SELECT * from inputtable order by ID DESC";
$selectinputs2=mysql_query($selectinputs) or die("Chat Error: 4052");
while(($selectinputs3=mysql_fetch_array($selectinputs)) && $selectinputslimit<20)
{
// some code here
if($wantedinput==1)
{
$selectinputslimit++;
}
else
{
}
}
print "$whateverwasabove";
Basicly, how would i go abouts turning the amount of things it looks throough to get it? When i explain it all the table is searched, i have ID indexed but cant think of a way to take advantage of this. In the code, it takes the data and puts it into 1 string and displays it afterwards but not everything i take i want to use, thats what the $selectinputslimit is for. Just dont know how to reduce what is searched, any ideas?
Is there a way for php to fix this?? or is it all SQL
PHP Code:
$selectinputslimit=0;
$selectinputs="EXPLAIN SELECT * from inputtable order by ID DESC";
$selectinputs2=mysql_query($selectinputs) or die("Chat Error: 4052");
while(($selectinputs3=mysql_fetch_array($selectinputs)) && $selectinputslimit<20)
{
// some code here
if($wantedinput==1)
{
$selectinputslimit++;
}
else
{
}
}
print "$whateverwasabove";
Basicly, how would i go abouts turning the amount of things it looks throough to get it? When i explain it all the table is searched, i have ID indexed but cant think of a way to take advantage of this. In the code, it takes the data and puts it into 1 string and displays it afterwards but not everything i take i want to use, thats what the $selectinputslimit is for. Just dont know how to reduce what is searched, any ideas?
Is there a way for php to fix this?? or is it all SQL