1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?php
//connexion
$config=array(
'Database'=>'*******',
'UID'=>'****',
'PWD'=>'*******');
$idconnect=sqlsrv_connect('(local)',$config);
if( $idconnect === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
//connexion
}
//requete des noms
$result=sqlsrv_query($idconnect,'SELECT codeinfo,nom FROM clientordon order by nom asc ' );
//requete des noms
//liste déroulante
echo '<form name="selection" action="proto_php_sqlserver.php" method="post">
<select name="liste_deroulante">';
//liste déroulante
while($nini=sqlsrv_fetch_array($result))
{
echo '<option value="'. $nini['nom'].' - '.'438'.$nini['codeinfo'].'">' . htmlentities($nini['nom']).'</option>';
}
//bouton
echo '</select>
<input type="submit" value="OK">
</form>';
//bouton
if (isset($_POST['liste_deroulante']))
{
$cli=$_POST['liste_deroulante'];
echo $_POST['liste_deroulante'];
//requete des Ecritures
// $resultecr=sqlsrv_query($idconnect,"SELECT CONVERT(Char(10),Dateecr,110) as Bondate, DEBITeur, CREDITeur, journal, libelle from ecriture where compte='43806079'");
$resultecr=sqlsrv_query($idconnect,"SELECT CONVERT(Char(10),Dateecr,110) as Bondate, DEBITeur, CREDITeur, journal, libelle from ecriture where compte='438".$nini['codeinfo'] . "'");
$NbreData =sqlsrv_num_rows($resultecr);
echo $NbreData;
echo $cli;
{
echo'<table border=3 width="50%" height="10%" cellspacing="15" cellpadding="5" bgcolor=#CCFFFF>
<tr align=right>
<TH> Date </TH>
<TH > Débit </TH>
<TH> Crédit </TH>
<TH> Libellé </TH>
</tr></table>';
}
while( $row = sqlsrv_fetch_array( $resultecr, SQLSRV_FETCH_ASSOC))
{
echo'<table border=4 width="50%" height="10%" cellspacing="15" cellpadding="5" bgcolor=#CCFFFF>
<td align="center" valign="right" width="50">
<font face="Comic Sans MS" size=1>'.$row['Bondate']."</font></td>
<td align='center' valign='right' bgcolor=#3399FF width='50'>
<font face='Comic Sans MS' size=1>".number_format($row['DEBITeur'],2,',',' ')."</font></td>
<td align='center' valign='right' bgcolor=#336699 width='50'><font face='Comic Sans MS' size=1>".number_format($row['CREDITeur'],2,',',' ')."</font></td>
<td align='center' valign='right' width='50' height='20'><font face='Comic Sans MS' size=1>".$row['libelle']."</font></td>
</table>";
}
}
?> |
Partager