WRInaute passionné
Bonjour
J'ai une erreur sur cette fonction
Ca me retourne l'erreur
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/local/apache/htdocs/sites/t/the-world-in-photos.com/index.php on line 54
Je ne comprends pas pourquoi!!!
Pourtant ma connection à la bdd et le code marche si ce n'est pas une fonction.
Quelqu'un voit le problème?
Merci
J'ai une erreur sur cette fonction
Code:
function aff_photos($cont)
{
$query="SELECT photo_small, title FROM wpa_photo WHERE valide=1 and photo_small LIKE '%/$cont/%' ORDER BY date_ins DESC, heure_ins DESC LIMIT 2";
$res_photo=@mysql_query($query,$db);
$nbr_photo=mysql_num_rows($res_photo);
for ($i=0; $i<$nbr_photo; $i++)
{
$list_photo=@mysql_fetch_row($res_photo);
$photos.="<div align='center'><a href='$list_aff_photo[4]' target='_blank'><img src='$list_photo[0]' border='0' alt=\"$list_photo[1]\"></a><br><br></div>";
}
return $photos;
}
$cont="southeast-asia";
echo aff_photos($cont);
Ca me retourne l'erreur
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/local/apache/htdocs/sites/t/the-world-in-photos.com/index.php on line 54
Je ne comprends pas pourquoi!!!
Pourtant ma connection à la bdd et le code marche si ce n'est pas une fonction.
Quelqu'un voit le problème?
Merci