haazheel | La syntaxe de mysql_result:
Code :
- $connexion = mysql_connect("$dbhost","$user","$password" );
- $query = "SELECT code FROM table WHERE categorie='blabla'";
- $result = mysql_query("$query",$connexion);
- $resultat = mysql_result($result,0,"categorie" );
|
Et si tu as plusieurs résultats, tu peux utiliser la syntaxe suivante:
Code :
- $connexion = mysql_connect("$dbhost","$user","$password" );
- $query = "SELECT code FROM table WHERE categorie='blabla'";
- $result = mysql_query("$query",$connexion);
- $lignes = mysql_num_rows($result);
- $i = 0;
- while($i < $lignes)
- {
- $resultat = mysql_result($result,$i,"categorie" );
- $i++;
- }
|
---------------
Another .Net Blog
|