anyone feel up to optimizing some code?
Posted: Tue Oct 18, 2005 11:44 am
just curious if anyone can think of a more effecient way to do the following..if not,no big deal:D-
Code: Select all
while ($i=mysql_fetch_object($query))
{
if (!isset($a))
{
$a=1;
}
$sel="SELECT DISTINCT gk_type,kart_name,kart_no FROM kart WHERE gk_type='$i->number' ORDER BY kart_no ASC";
$query2=mysql_query($sel);
$count=mysql_num_rows($query2);
if ($count > 0)
{
@$expand=$_REQUEST['expand'.$i->number.''];
if ($a==1)
{
echo ("<b><div align='left'>$i->name");
if ($expand != "expand".$i->number."")
{
echo ("<br /><a href='index.php?page=NULL&expand".$i->number."=expand".$i->number."'>
<font size='2'>Expand</font></a></div></b><br />");
}
else
{
echo ("<br /><a href='index.php'>
<font size='2'>Minimize</font></a></div></b><br />");
}
}
else
{
echo ("<br /><br /><b><div align='left'>$i->name");
if ($expand != "expand".$i->number."")
{
echo ("<br /><a href='index.php?page=NULL&expand".$i->number."=expand".$i->number."'>
<font size='2'>Expand</font></a></div></b><br />");
}
else
{
echo ("<br /><a href='index.php'>
<font size='2'>Minimize</font></a></div></b><br />");
}
}
while ($o=mysql_fetch_object($query2))
{
@$check="expand".$o->gk_type."";
if ($expand==$check)
{
echo (" <a href='index.php?kart=$o->kart_no'>$o->kart_no $o->kart_name</a><br />");
}
}
}
$a++;
}