optimisation code
Posté : 21 avr. 2006, 15:14
Bonjour,
je voudrais savoir comment je peux optimiser mon code suivant.
si vous avez des remarques
Merci d'avance
je voudrais savoir comment je peux optimiser mon code suivant.
si vous avez des remarques
Merci d'avance
<?php
include ('entetesecu.php');
require ('fonctions.php');
?>
<?php
//liste les tables
$liste ="SHOW tables from ".$database;
$req_liste = mysql_query ($liste) or die (mysql_error());
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<!-- encadrement haut-->
<table border="0" cellpadding="0" cellspacing="0" width=920>
<tr>
<td colspan="2" class="CadreMenu"><img src="<?php echo $chemin_image; ?>px.gif" width="150" height="1"></td>
</tr>
<tr><img src="<?php echo $chemin_image; ?>px.gif" height="19" width="8" border="0">
<td width="1" class="CadreMenu"><img src="<?php echo $chemin_image; ?>px.gif" idth="1" height="1"></td>
<td><!-- fin encadrement haut -->
<table>
<tr>
<td> </td>
<td> </td>
<td><br>
<font color="#0E78C8">Liste des tables SQL :</font><br><br><table><tr><td colspan="50">
<?php
$i=0;
while ($ligne_liste = mysql_fetch_array($req_liste,MYSQL_NUM))
{
$desc="Select ".$description_table_field." from ".$dbnom_table." where ".$nom_table_table_field." = '".$ligne_liste[0]."'";
$result_desc=mysql_query($desc) or die (mysql_error());
$row=mysql_fetch_array($result_desc,MYSQL_NUM);
if ($i==0)
{
echo '<img src="../image/droite.gif">';
echo ' <a target="_blank" href="'.$page_visubdd.$ext.'?table='.$ligne_liste[0].'" class="Menu" name='.$ligne_liste[0].' >'.$ligne_liste[0].'</a><br>';
echo " ";
echo '<font color="CCCCCC">'.$row[0].'</font><br><br></td><td colspan="100"></td>';
$i++;
}
else
{
if ( $i%2 != 0 )
{
echo '<td colspan="50">';
echo '<img src="../image/droite.gif">';
echo ' <a target="_blank" href="'.$page_visubdd.$ext.'?table='.$ligne_liste[0].'" class="Menu" name='.$ligne_liste[0].' >'.$ligne_liste[0].'</a><br>';
echo " ";
echo '<font color="CCCCCC">'.$row[0].'</font><br><br></td></tr>';
$i++;
}
else
{
echo '<tr><td colspan="50">';
echo '<img src="../image/droite.gif">';
echo ' <a target="_blank" href="'.$page_visubdd.$ext.'?table='.$ligne_liste[0].'" class="Menu" name='.$ligne_liste[0].' >'.$ligne_liste[0].'</a><br>';
echo " ";
echo '<font color="CCCCCC">'.$row[0].'</font><br><br></td><td colspan="100"> </td>';
$i++;
}
}
}
mysql_free_result($req_liste);
mysql_free_result($result_desc);
mysql_close();
?></table>
</td>
</tr>
</table>
<img src="<?php echo $chemin_image; ?>px.gif" height="47" width="1" border="0"></td>
<td width="1" class="CadreMenu"><img src="<?php echo $chemin_image; ?>px.gif" width="1" height="1"></td>
</tr>
<tr>
<td colspan="2" class="CadreMenu"><img src="<?php echo $chemin_image; ?>px.gif" width="150" height="1"></td>
</tr>
</table>
<?php include ('pied.php');?>