<?php $link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* Vérification de la connexion */ if (mysqli_connect_errno()) { printf("Echec de la connexion : %s\n", mysqli_connect_error()); exit(); }
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Récupération des informations des champs pour toutes les colonnes */ while ($finfo = mysqli_fetch_field($result)) {
/* Récupération de la position du champ dans le curseur */ $currentfield = mysqli_field_tell($result);
printf("Colonne %d:\n", $currentfield); printf("Nom : %s\n", $finfo->name); printf("Table : %s\n", $finfo->table); printf("Longueur Max. : %d\n", $finfo->max_length); printf("Flags : %d\n", $finfo->flags); printf("Type : %d\n\n", $finfo->type); } mysqli_free_result($result); }
/* Fermeture de la connexion */ mysqli_close($link); ?>
|