$resultat->($query,$bdd) or die ();;
<!DOCTYPE html>
<head>
<title>tableau dynamique </title>
<link rel="stylesheet" type="text/css" href="scroller.css">
</head>
<body>
<center><h1>Abonnements</h1></center>
<div class= "border_table">
<center>
<?php
require_once "PDO_connect.php";
$query='SELECT * FROM smartphone.abonnements;';
$resultat->($query,$bdd) or die ();;
$total=($resultat);
if($total) {
echo'<div class="scroller" <table bgcolor="#FFFFFF">'."\n";
echo '<table border="1">'."\n";
echo "<tr>";
echo '<th>Operateur<th>';
echo '<th>SIM<th>';
echo '<th>PUK<th>';
echo '<th>Num ligne<th>';
echo '<th>Volume<th>';
echo '<th>Statut abo<th>';
echo "</tr>";
while($row = mysql_fetch_assoc($resultat)) {
echo '<td>'.$row["Operateur"].'<td>';
echo '<td>'.$row["Num SIM"].'<td>';
echo '<td>'.$row["PUK"].'<td>';
echo '<td>'.$row["Num ligne"].'<td>';
echo '<td>'.$row["Volume"].'<td>';
echo '<td>'.$row["Statut abo"].'<td>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
}
else echo 'Pas d\'enregistrements dans cette table...';
?>
<form action="option.php" method="get">
Nom :<select name="nom">
<option value="name1">name1</option>
<option value="name2">name2</option>
<option value="name3">name3</option>
<option value="name4">name4</option>
</select><br>
</form>
</center>
<?
<?php
if(isset($_GET['nom']))
{
$name=$_GET['nom'];
$c=mysql_connect("localhost","root","Mm101010");
mysql_select_db("smartphone.employe");
$ins=mysql_query("INSERT INTO `option`
(name)
VALUES ('$name')",$c) or die(mysql_error());
if($ins)
{
echo "<br>".$name."inserted";
}
}
?>
<br><br>
<center>
<a class="Affectation" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Affectation.php" rel="nofollow noopener noreferrer" target="_blank">Affectation</a>
<a class="Equipement" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Equipement.php" rel="nofollow noopener noreferrer" target="_blank">Equipement</a>
<a class="Reaffectation_Equipement" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Reaffectation_Equipement.php" rel="nofollow noopener noreferrer" target="_blank">Reaffectation Equipement</a>
<a class="Nouvelle_Affectation" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Nouvelle_Affectation.php" rel="nofollow noopener noreferrer" target="_blank">Nouvelle Affectation</a>
<a class="Employe" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Employe.php" rel="nofollow noopener noreferrer" target="_blank">Employe</a>
<a class="Modele" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Modele.php" rel="nofollow noopener noreferrer" target="_blank">Modele</a><br>
</center>
<center><table>
<tr><td><div class="Operateur"> Operateur<input type="text" name="Operateur"> </div></td>
<td>                                     </td>
<td><div class="Num_SIM"> Num SIM :<input type="text" name="Num_SIM"></div></td></tr>
<td>                                     </td>
<tr><td><div class="PUK"> PUK : <input type="text" name="PUK"></div></td>
<td>                                     </td>
<td><div class="Num_ligne"> Num ligne :<input type="text" name="Num_ligne"></div></td></tr>
<td>                                     </td>
<tr><td><div class="Volume"> Volume :<input type="text" name="Volume"></div></td>
<td>                                     </td>
<td><div class="Statut_Abo"> Statut Abo :<input type="text" name="Statut_Abo"></div></td></tr>
</table>
</center>
</body>
</html>
<?php
// Fichier de connexion à la bdd : cnxBdd.php
$host = "localhost";
$user = "root";
$pass = "";
$dbn = "smartphone";
try{
$bdd = new PDO("mysql:host=".$hostname.";dbname=".$dbn, $user, $pass);
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$bdd->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
} catch(PDOException $e) {
die('Erreur : ' . $e->getMessage());
}
?>
$resultat->($query,$bdd) or die ();;
if(isset($_GET['nom'])) { $name=$_GET['nom'];
while($row = mysql_fetch_assoc($resultat)) {
<!DOCTYPE>
<html>
<head>
<title>tableau dynamique </title>
<link rel="stylesheet" type="text/css" href="scroller.css">
</head>
<body>
<center><h1>Abonnements</h1></center>
<div class= "border_table">
<center>
<?php
require"PDO_connect.php";
$query='SELECT * FROM smartphone.abonnements;';
//$resultat=mysql_query($query,$bdd)();
foreach ($bdd->query($sql) as $row) {
$total=($resultat);
if($total) {
echo'<div class="scroller" <table bgcolor="#FFFFFF">'."\n";
echo '<table border="1">'."\n";
echo "<tr>";
echo '<th>Operateur<th>';
echo '<th>SIM<th>';
echo '<th>PUK<th>';
echo '<th>Num ligne<th>';
echo '<th>Volume<th>';
echo '<th>Statut abo<th>';
echo "</tr>";
while($row = mysql_fetch_assoc($resultat)) {
echo '<td>'.$row["Operateur"].'<td>';
echo '<td>'.$row["Num SIM"].'<td>';
echo '<td>'.$row["PUK"].'<td>';
echo '<td>'.$row["Num ligne"].'<td>';
echo '<td>'.$row["Volume"].'<td>';
echo '<td>'.$row["Statut abo"].'<td>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
}
else echo 'Pas d\'enregistrements dans cette table...';
?>
</center>
<br><br>
<center>
<a class="Affectation" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Affectation.php" rel="nofollow noopener noreferrer" target="_blank">Affectation</a>
<a class="Equipement" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Equipement.php" rel="nofollow noopener noreferrer" target="_blank">Equipement</a>
<a class="Reaffectation_Equipement" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Reaffectation_Equipement.php" rel="nofollow noopener noreferrer" target="_blank">Reaffectation Equipement</a>
<a class="Nouvelle_Affectation" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Nouvelle_Affectation.php" rel="nofollow noopener noreferrer" target="_blank">Nouvelle Affectation</a>
<a class="Employe" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Employe.php" rel="nofollow noopener noreferrer" target="_blank">Employe</a>
<a class="Modele" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Modele.php" rel="nofollow noopener noreferrer" target="_blank">Modele</a><br>
</center>
<center><table>
<tr><td><div class="Operateur"> Operateur<input type="text" name="Operateur"> </div></td>
<td> </td>
<td><div class="Num_SIM"> Num SIM :<input type="text" name="Num_SIM"></div></td></tr>
<td> </td>
<tr><td><div class="PUK"> PUK : <input type="text" name="PUK"></div></td>
<td> </td>
<td><div class="Num_ligne"> Num ligne :<input type="text" name="Num_ligne"></div></td></tr>
<td> </td>
<tr><td><div class="Volume"> Volume :<input type="text" name="Volume"></div></td>
<td> </td>
<td><div class="Statut_Abo"> Statut Abo :<input type="text" name="Statut_Abo"></div></td></tr>
</table>
</center>
</body>
</html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<?php //Affichage des erreurs PHP error_reporting(E_ALL) //connexion à la BDD require"PDO_connect.php" // La requete : $query=SELECT * FROM smartphone.abonnements try{ $prep = $bdb->prepare($query) $prep->execute() //on stocke le résultat dans un ARRAY $resultats = $prep->fetchAll() }catch(Exception $e){ //en cas derreur dans la requete echo "Erreur ! ".$e->getMessage() } ?> <!DOCTYPE> <html> <head> <meta charset="utf8"> <title>tableau dynamique </title> <link rel="stylesheet" type="text/css" href="scroller.css"> </head> <body> <center><h1>Abonnements</h1></center> <div class= "border_table"> <center> <div class="scroller" <table bgcolor="#FFFFFF"> <table border="1"> <thead> <tr> <th>Operateur<th> <th>SIM<th> <th>PUK<th> <th>Num ligne<th> <th>Volume<th> <th>Statut abo<th> </tr> </thead> <tbody> <?php // si l'array contient des valeurs if(!empty($resultats)){ //on boucle sur chaque ligne de l'array foreach ($resultats as $row) { echo "<tr>" echo "<td>".$row["Operateur"]."<td>"; echo "<td>".$row["Num SIM"]."<td>"; echo "<td>".$row["PUK"]."<td>"; echo "<td>".$row["Num ligne"]."<td>"; echo "<td>".$row["Volume"]."<td>"; echo "<td>".$row["Statut abo"]."<td>"; echo "</tr>"; }//fin foreach }else { echo "Pas d'enregistrements dans cette table..."; } ?> </tbody> </table> </center> <br><br> <center> <a class="Affectation" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Affectation.php" rel="nofollow noopener noreferrer" target="_blank">Affectation</a> <a class="Equipement" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Equipement.php" rel="nofollow noopener noreferrer" target="_blank">Equipement</a> <a class="Reaffectation_Equipement" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Reaffectation_Equipement.php" rel="nofollow noopener noreferrer" target="_blank">Reaffectation Equipement</a> <a class="Nouvelle_Affectation" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Nouvelle_Affectation.php" rel="nofollow noopener noreferrer" target="_blank">Nouvelle Affectation</a> <a class="Employe" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Employe.php" rel="nofollow noopener noreferrer" target="_blank">Employe</a> <a class="Modele" href="http://localhost/formulaire/Form_PHP/php_presque_fini/Modele.php" rel="nofollow noopener noreferrer" target="_blank">Modele</a><br> </center> <center> <table> <tr> <td><div class="Operateur"> Operateur<input type="text" name="Operateur"> </div></td> <td></td> <td> <div class="Num_SIM"> Num SIM :<input type="text" name="Num_SIM"></div> </td> </tr> <tr> <td><div class="PUK"> PUK : <input type="text" name="PUK"></div></td> <td></td> <td> <div class="Num_ligne"> Num ligne :<input type="text" name="Num_ligne"></div> </td> </tr> <tr> <td> <div class="Volume"> Volume :<input type="text" name="Volume"></div> </td> <td></td> <td> <div class="Statut_Abo"> Statut Abo :<input type="text" name="Statut_Abo"></div> </td> </tr> </table> </center> </body> </html>