thibaud
Bonjour!
Vous n'êtes pas très bons pour les pronostics, les amis… <php>
$sFileDb = "/home/httpd/vhosts/laure-marc.ch/httpdocs/conf/thibaud.sql3";
// DB queries $oDb = new SQLite3($sFileDb, 0666, $sErr); if ($sErr) exit($sErr);
$sSql = "SELECT count(*) FROM pronostics WHERE sexe='boy';"; $iBoy = $oDb->querySingle($sSql);
$sSql = "SELECT count(*) FROM pronostics WHERE sexe='girl';"; $iGirl = $oDb->querySingle($sSql);
$iBoyPourcent = round(($iBoy)/($iBoy+$iGirl)*100); $iGirlPourcent = round(($iGirl)/($iBoy+$iGirl)*100);
// Debug // echo ($iBoy + $iGirl) . " paris, soit $iBoy ($iBoyPourcent %) garçon, $iGirl ($iGirlPourcent %) fille \n";
echo '<table border="0">
<tr>
<td>
<img src="/lib/exe/fetch.php?media=bebe:boy.png">
</td>
<td>
<img src="/lib/exe/fetch.php?media=bebe:boy_color.png" width="'. $iBoyPourcent*3 .'" height="15">
<img src="/lib/exe/fetch.php?media=bebe:girl_color.png" width="'. $iGirlPourcent*3 .'" height="15">
<table width="100%">
<tr>
<td align="center" >garçon</td>
<td align="center">fille</td>
</tr>
<tr>
<td align="center">'.$iBoyPourcent.' % </td>
<td align="center">'.$iGirlPourcent.' % </td>
</tr>
</table>
</td>
<td>
<img src="/lib/exe/fetch.php?media=bebe:girl.png">
</td>
</tr> </table>'; </php>
<php>
$sFileDb = "/home/httpd/vhosts/laure-marc.ch/httpdocs/conf/thibaud.sql3";
$oDb = new SQLite3($sFileDb, 0666, $sErr); if ($sErr) exit($sErr);
$sSql = "SELECT name, sexe FROM pronostics";
$oQuery = $oDb->query($sSql);
while($aRow = $oQuery->fetchArray(SQLITE3_ASSOC)){
$aRows[] = $aRow;
};
print “<table>”;
print “<tr><th>Nom</th><th>Pari</th></tr>”;
foreach ($aRows as $aRow) {
print "<tr><td>".$aRow['name']."</td><td>".$aRow['sexe']."</td></tr>";
} print “</table>”;
</php>
thibaud.txt · Dernière modification : de marc
