function mysql_die($error_message '', $the_query '') { if (empty($error_message)) { $error_message = mysql_error(); } if (empty($the_query)) { $the_query = "Requête inconnue..."; } echo " <html><head><title>Erreur Base de données</title></head> <center> Problème technique ERREUR de base de données Mysql </center> </html> "; } Puis lors de ta requête : <code> $query="SELECT*FROM Dida"; $mysql_result = mysql_query($query); if (mysql_error()) { $error = mysql_error(); mysql_die($error, $query); exit(); }
$query="SELECT*FROM Dida"; $mysql_result = mysql_query($query) or mysql_die(mysql_error(), $query); exit(); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionwhile($row=mysql_fetch_array($result)) { echo "Enregistrement #" . $row[0] . " : "; echo $row[1] ." > "; echo $row[2] ." > "; echo $row[3] ." > "; echo $row[4] . " "; }
<html> <head> <title></title> </head> <?php $host="localhost"; $user="root"; $pass=""; $base="didactitiel"; ?> </html>
<html> <head> <title>Tableau</title> </head> <?php include("ID.htaccess\sql.php"); $connect=mysql_connect($host,$user,$pass); $mabase=mysql_select_db("didacticiel", $connect); $requete="SELECT*FROM Dida"; echo " "; $result=mysql_query($requete); $all=mysql_fetch_array($result); $a=1; // Affiche l'enregistrement ayant un ID = 1 echo "Enregistrement #" . $all["id"] ." "; echo $all["nom"]." "; echo $all["prénom"] ." "; echo $all["email"] ." "; echo $all["date"] ." "; //Fontionne pas avec la boucle suivante : //while ($all=mysql_fetch_array($result) == TRUE) //{ // echo "Enregistrement #" . $all["id"] . " : "; // echo $all["nom"] ." > "; // echo $all["prénom"] ." > "; // echo $all["email"] ." > "; // echo $all["date"] . " "; //} //$row=mysql_fetch_row($result); mysql_free_result($result); mysql_close($connect); ?> </html>