Mysql_fetch_array() expects parameter 1
merlyone
Messages postés
25
Date d'inscription
Statut
Membre
Dernière intervention
-
Gauthier -
Gauthier -
Bonsoir,
J'ai beau essayé de recupérer et d'afficher les données de la base mais j'obtiens toujours l'erreur "Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in D:\wamp\......" ! je fais donc appel a vous pour avoir la solution voici le code :
<?php
include("connexion.php");
$req ="select email,categorie,code_postal,titre,telephone,description from annonceur where id=105" ;
mysql_query($req) or die('Erreur SQL !'.$req.'<br>'.mysql_error());
while($lignes=mysql_fetch_array($req))
{
$email = $lignes["email"];
$categorie = $lignes["categorie"];
$CP = $lignes["code_postal"];
$titre = $lignes["titre"];
$tel = $lignes["telephone"];
$desciption = $lignes["description"];
$photo = $lignes["photo"];
}
echo'<tr>
<td> Email: $email; </td> //Affichage des valeurs
<td>categorie: $categorie; </td>
<td> code postal: $CP; </td>
<td> titre: $titre; </td>
<td> telephone: $tel; </td>
<td> description: $description; </td>
<td> photo: $photo; </td>
</tr>'
?>
J'ai beau essayé de recupérer et d'afficher les données de la base mais j'obtiens toujours l'erreur "Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in D:\wamp\......" ! je fais donc appel a vous pour avoir la solution voici le code :
<?php
include("connexion.php");
$req ="select email,categorie,code_postal,titre,telephone,description from annonceur where id=105" ;
mysql_query($req) or die('Erreur SQL !'.$req.'<br>'.mysql_error());
while($lignes=mysql_fetch_array($req))
{
$email = $lignes["email"];
$categorie = $lignes["categorie"];
$CP = $lignes["code_postal"];
$titre = $lignes["titre"];
$tel = $lignes["telephone"];
$desciption = $lignes["description"];
$photo = $lignes["photo"];
}
echo'<tr>
<td> Email: $email; </td> //Affichage des valeurs
<td>categorie: $categorie; </td>
<td> code postal: $CP; </td>
<td> titre: $titre; </td>
<td> telephone: $tel; </td>
<td> description: $description; </td>
<td> photo: $photo; </td>
</tr>'
?>
A voir également:
- Mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in
- Qwerty to azerty - Guide
- Navigation in private - Guide
- Press esc in 1 seconds to skip startup.nsh any other key to continue ✓ - Forum Windows 10
- Deco in paris avis ✓ - Forum Consommation & Internet
- Press ESC in 1 second to skip startup.nsh, Any other keys - Forum Windows 10
1 réponse
mysql_fetch_array() prend comme paramètre la réponse de mysql_query(), hors ici une requête est passé en paramètre... il faut donc faire :
$reponse = mysql_query($req) or die('Erreur SQL !'.$req.'<br>'.mysql_error()); while($lignes=mysql_fetch_array($reponse)) ...
merlyone
Messages postés
25
Date d'inscription
Statut
Membre
Dernière intervention
Merci pour l'aide je vais essayer pou voir si ça marche !
WizziLife
merci à toi !!
Gauthier
merci beaucoup pour votre réponse et ça m'a beaucoup aidé