Académique Documents
Professionnel Documents
Culture Documents
Exercice n° 1 :
<HTML>
<HEAD>
<TITLE>TP 2 EX1</TITLE>
</HEAD>
<BODY>
<table border="1">
<tr><td>Nom</td><td>Adresse</td><td>Ville</td><td>Pays</td></tr>
<?
mysql_select_db("base_test");
echo"<tr>";
echo"<td>".$voir['nom']."</td>";
echo"<td>".$voir['adresse']."</td>";
echo"<td>".$voir['ville']."</td>";
echo"<td>".$voir['pays']."</td>";
echo"</tr>";
?>
</table>
</BODY>
</HTML>
Exercice n° 2 :
<HTML>
<HEAD>
<TITLE>TP 2 EX1</TITLE>
</HEAD>
<BODY>
<table>
<select name="code">
<?
mysql_select_db("base_test");
echo"<option value=".$voir['code'].">".$voir['nom']."</option>";
?>
</select>
</form>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Suite Ex2</TITLE>
</HEAD>
<BODY>
<table border="1">
<tr>
<td>Numero commande</td>
<td>Date Commande</td>
<td>Total</td>
</tr>
<?
mysql_select_db("base_test");
echo"<tr>";
echo"<td>".$voir['numerocmd']."</td>";
echo"<td>".$voir['datecmd']."</td>";
echo"<td>".$voir['totalcmd']."</td>";
echo"</tr>";
?>
</table>
</body>
</html>
Exercice n° 3 :
<HTML>
<HEAD>
<TITLE>Ajout de produit</TITLE>
</HEAD>
<BODY>
<table>
<tr>
<?
mysql_select_db("base_test");
echo"<option value=".$voir['code'].">".$voir['designation']."</option>";
?>
</select>
</td>
</tr>
<tr>
</tr>
</table>
</form>
</body>
</html>
****page ajout.php****
<HTML>
<HEAD>
<TITLE>suite Ex3</TITLE>
</HEAD>
<BODY>
<?
mysql_select_db("base_test");
if (mysql_num_rows($result)==0)
else
?>
</table>
</body>
</html>
Exercice n° 4 :
<html>
<head>
<title>liste produits</title>
</head>
<body>
<table border="1">
<tr>
<td>Référence</td>
<td>Désignation</td>
<td>Catégorie</td>
<td>Prix</td>
<td colspan=2>Opération</td>
</tr>
<?
mysql_select_db("base_test");
echo"<tr>";
echo"<td>".$voir['reference']."</td>";
echo"<td>".$voir['designation']."</td>";
$execut=mysql_fetch_array($resultat);
echo"<td>".$execut['designation']."</td>";
echo"<td>".$voir['prix']."</td>";
echo"<td>"."<a href=modifierproduit.php?ref=".$voir['reference'].">modifier</a></td>";
echo"<td>"."<a href=supprimerproduit.php?ref=".$voir['reference'].">supprimer</a></td>";
echo"</tr>";
?>
</table>
</body>
</html>
<html>
<head>
<title>Modifier produit</title>
</head>
<body>
<h2>Modifier produit</h2>
<?
If(!isset($_POST[‘B1’]){
mysql_select_db("base_test");
<table>
<tr>
<td>Désignation</td>
?>
<tr>
</tr>
</table>
</form>
<? } else{
$excution=mysql_db_query("base_test",$requete); }
?>
</body>
</html>
<?
mysql_select_db("base_test");
?>
Exercice n° 5 :
<HTML>
<HEAD>
<TITLE>affichage catégorie</TITLE>
</HEAD>
<BODY>
<table border=1>
<tr>
<td>Désignation catégorie</td>
<td>Nombre de produit</td>
</tr>
<?
mysql_select_db("base_test");
echo"<tr><td><a href=liste.php?ref=".$voir[2].">".$voir[0]."</a></td>";
echo"<td>".$voir[1]."</td></tr>";
?>
</table>
</BODY>
</HTML>
<html>
<head>
<title>liste produits</title>
</head>
<body>
<table border="1">
<tr>
<td>Référence</td>
<td>Désignation</td>
<td>Prix</td>
</tr>
<?
mysql_select_db("base_test");
echo"<tr>";
echo"<td>".$voir['reference']."</td>";
echo"<td>".$voir['designation']."</td>";
echo"<td>".$voir['prix']."</td>";
echo"</tr>";
?>
</table>
</body>
</html>