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
| <?php
$tmp = explode (" ",$_GET['texte']);
$code = $tmp[0];
$compte = $tmp[1];
$montant = $tmp[2];
$conn = mysql_connect ("localhost","root","");
mysql_select_db ("bank",$conn);
$req = "select montant,num_compte from client where code = '$code'";
$res = mysql_query ($req);
$ligne = mysql_fetch_array($res);
$dispoE = $ligne['montant'];
$id = $ligne['num_compte'];
if ($dispoE >= $montant)
{
$req1 = "select montant from client where num_compte = '$compte'";
$res1 = mysql_query ($req1);
$ligne1 = mysql_fetch_array($res1);
$dispoR = $ligne1[0];
$dispoE = ($dispoE - $montant);
$dispoR = ($dispoR + $montant);
$req2 = "update client set montant = $dispoR where num_compte = '$compte'";
$res2 = mysql_query ($req2);
$req3 = "update client set montant = $dispoE where num_compte= '$id'";
$res3 = mysql_query ($req3);
}
Else echo "disponibilite non suffisante";
?> |
Partager