Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost:3306";
- $user='root';
- $password="";
- $dbname="Transport_aerien";
- $connect = @mysql_connect($host, $user, $password); // connexion à l'administrateur en entrant un user et un pswd//
- if ( $connect == true) // si la connexion est établie//
- echo "Connexion reussie<br><br>";
- else echo "Connexion non établie <br><br>"; // sinon la connexion est non établie //
- $select_db = @mysql_select_db($dbname,$connect); // déclaration de la selection de la base de données //
- if ( $select_db == true) // si la connexion est établie//
- echo "select_db ok<br><br>";
- else echo "select_db erreur<br><br>"; // sinon la connexion est non établie //
- $reponse = @mysql_query('SELECT PLNUM,PLNOM FROM pilote'); // réponse de la requête sql //
- if ( $reponse == false) // si la base de données correspond à dbname //
- echo "erreur mysql_query<br><br>";
- else echo "mysql_query ok<br><br>"; // sinon la connexion est non établie //
- $N = @mysql_num_fields($reponse);
- echo "$N colonnes<br><br>";
- //$col0 = @mysql_field_name($reponse , 0);
- //echo "colonne n°0 = $col0<br><br>";
- $ligne = mysql_fetch_array($reponse );
- echo "<table border=1> <tr>";
- for ($i=0; $i<$N; $i++) echo "<th>". mysql_field_name ($reponse,$i) . "</th>";
- echo "</tr>";
- while ( ($ligne = mysql_fetch_array($reponse)) != false ){
- echo "<tr>";
- for ($i=0; $i<$N; $i++) echo "<td>$ligne[$i]</td>";
- echo "</tr>";
- }
- echo "</table>";
- //-----------------------------------------------------------------------------------------------
- $reponse = @mysql_query('SELECT * FROM pilote'); // réponse de la requête sql //
- if ( $reponse == false) // si la base de données correspond à dbname //
- echo "erreur mysql_query<br><br>";
- else echo "mysql_query ok<br><br>"; // sinon la connexion est non établie //
- $N = @mysql_num_fields($reponse);
- echo "$N colonnes<br><br>";
- //$col0 = @mysql_field_name($reponse , 0);
- //echo "colonne n°0 = $col0<br><br>";
- $ligne = mysql_fetch_array($reponse );
- echo "<table border=1> <tr>";
- for ($i=0; $i<$N; $i++) echo "<th>". mysql_field_name ($reponse,$i) . "</th>";
- echo "</tr>";
- while ( ($ligne = mysql_fetch_array($reponse)) != false ){
- echo "<tr>";
- for ($i=0; $i<$N; $i++) echo "<td>$ligne[$i]</td>";
- echo "</tr>";
- }
- echo "</table>";
- //---------------------------------------------------------------------------------------------
- $reponse = @mysql_query(' SELECT DISTINCT * FROM pilote, vol WHERE (pilote.PLNUM = vol.PLNUM) '); // réponse de la requête sql //
- if ( $reponse == false) // si la base de données correspond à dbname //
- echo "erreur mysql_query<br><br>";
- else echo "mysql_query ok<br><br>"; // sinon la connexion est non établie //
- $N = @mysql_num_fields($reponse);
- echo "$N colonnes<br><br>";
- //$col0 = @mysql_field_name($reponse , 0);
- //echo "colonne n°0 = $col0<br><br>";
- $ligne = mysql_fetch_array($reponse );
- echo "<table border=1> <tr>";
- for ($i=0; $i<$N; $i++) echo "<th>". mysql_field_name ($reponse,$i) . "</th>";
- echo "</tr>";
- while ( ($ligne = mysql_fetch_array($reponse)) != false ){
- echo "<tr>";
- for ($i=0; $i<$N; $i++) echo "<td>$ligne[$i]</td>";
- echo "</tr>";
- }
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement