Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1597 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  pb php/mysql/mysql_num_rows()

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

pb php/mysql/mysql_num_rows()

n°673553
sironimo
daboulkanietch
Posté le 14-03-2004 à 22:13:49  profilanswer
 

reobnjour voilà g encore un problème avec mon php mais today c avec mysql que ça plante.
Voilà je vous passe mon code php :
if (($prixmin=="" ) && ($prixmax=="" ) && ($surfmin=="" ) && ($surfmax=="" ) && ($cp=="" ) && ($ville=="" ))
{
//connexion a mysql et a "agence immobilière"
$lien=mysql_connect("127.0.0.1","sironimo","fcgbfcgb" ) or die ("erreur de connexion mysql" );
mysql_select_db("agence immobilière", $lien) or die ("erreur de connexion sur la base" );
$res = "$m2 where $m3;";
$resultat=mysql_query($res);
?>
<table bgcolor='lightyellow'>
<tr><th>numero d'annonce</th><th>prix</th><th>surface</th></tr>
<?php
$i=0;
while($i < mysql_num_rows($resultat))
{
echo "<tr><td>"; echo mysql_result($resultat,$i,'num_annonce');
echo "</td><td>"; echo mysql_result($resultat,$i,'prix');
echo "</td><td>"; echo mysql_result($resultat,$i,'surface');
echo "</td></tr>";
$i++;
}
?>
</table>
<?php
}
 
voici maitenant l'erreu qu'il me renvoit :
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\easyphp\www\agence\rechercheres.php on line 207
 //la ligne 207 correspondant au while.
 
Voilà j'aimerais savoir pourquoi ca marche kar g testé a ma fac sous linux et ca marche bien.
merci d'avance!

mood
Publicité
Posté le 14-03-2004 à 22:13:49  profilanswer
 

n°673556
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 14-03-2004 à 22:16:45  profilanswer
 

Eh ba ça veut dire que $resultat est null donc que ton mysql_query a planté. Fais donc echo mysql_error(); juste après ton mysql_query() et t'auras des infos sur ce qui ne marche pas. Très certainement ton SQL qui n'est pas bon.


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°673558
sironimo
daboulkanietch
Posté le 14-03-2004 à 22:17:39  profilanswer
 

non c bon dsl je m'étais trompé dans le nom de ma table lol dsl pour le dérangement.
merci pour l'aide taiche quand meme.
bye


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  pb php/mysql/mysql_num_rows()

 

Sujets relatifs
[PHP Mysql] probleme pour avoir la difference entre 2 dates.Erreur MySQL
[MySQL] Comment se connecter à distance à un serveur Apache / EasyPHP?[BCB6] Comment utiliser les librairies MySQL ?
[MySQL] Besoin d'aide à propos des types de colonnes[PHP/MySQL] requete avec "LIKE $a" mais avec si $a='%' ?
Probleme avec Mysql_num_rows, je vois pas laWarning: mysql_num_rows(): supplied argument ...
pt prob de newb -> Warning: mysql_num_rows(): supplied argument is notUn mysql_num_rows rapide [résolu]
Plus de sujets relatifs à : pb php/mysql/mysql_num_rows()


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR