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
| <?php
$db_user = "root";
$db="travailinfo";
$db_pass = "mysql";
$db_host = 'localhost';
$link= mysql_connect($db_host, $db_user, $db_pass);
if (! $link)
die("Impossible de se connecter à la base de données");
mysql_select_db($db , $link)
or die("Impossible d'ouvrir $db: ".mysql_error());
$request=mysql_query("select Idclient,NomClient,VilleClient from CLIENT");
if(!$request)
{
print("erreur de recherche :".mysql_error());exit;
}
print("<form action=assoc_client_livre.php method=post>
<b>Choisissez le client</b><br>
<select name=Idclient>");
while ($row=mysql_fetch_array ($request))
{
print("<option value=$row[0]>$row[1] | $row[2]</option> ");
}
print("</select>");
print("<br><br>");
$request=mysql_query("select Idlivre,TitreLivre,Auteur from LIVRE");
if(!$request)
{
print("erreur de recherche :".mysql_error());exit;
}
print("<b>Choisissez le livre</b><br>
<select name=Idlivre>");
while ($row=mysql_fetch_array ($request))
{
print("<option value=$row[0]>$row[1] | $row[2]</option>");
}
print("</select>
<br><br><br><br><input type=submit value=Louer>
</form> ");
$sql = "SELECT NomClient, TitreLivre FROM CLIENT, LIVRE
WHERE CLIENT.Idclient=LIVRE.Idlivre";
mysql_close($link);
?> |
Partager