1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<?php
mysql_connect(localhost,root) or die ("Impossible de se connecter");
mysql_select_db(test) or die ("Impossible de contacter la base");
$nligne='<br></br>';
//On place la requéte dans une variable :
$sql='select * from `test`.`gens`';
echo $nligne;
$repsql= mysql_query($sql);
echo $repsql;
echo $nligne;
$repphp= mysql_num_rows($repsql);
echo $nligne;
echo 'Il y a '.$repphp.' enregistrements dans la table correspondants';
echo $nligne;
$repphp2=mysql_fetch_assoc ($repsql);
echo(" ".$repphp2["nom"]." ".$repphp2["prenom"]." ".$repphp2["age"]);
echo $nligne;
?> |
Partager