PDA

View Full Version : Mysql problem



Louis Cloutier
11-23-2007, 10:03 PM
Why mysql_fetch_object() does not work???

I use it and it said

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/pafzonec/public_html/topsite/banniere/index.php on line 54

Thanks to answer

Louis Cloutier

RDM
11-23-2007, 10:53 PM
you probably have an error in you query. Post your code.

Louis Cloutier
11-23-2007, 11:22 PM
There is

while ($Article=mysql_fetch_object($Selection))

$total = mysql_num_rows($Selection);

while ($Article=mysql_fetch_object($Selection))

These lines does not work

Thanks

Louis Cloutier

RDM
11-23-2007, 11:47 PM
Please show all of the code or at least the MySQL query statement.

Louis Cloutier
11-23-2007, 11:52 PM
$sql = "SELECT id, Nom_site, Image_banniere, Description, Hits, genre, statut FROM banniere WHERE statut='1' ORDER BY Hits DESC LIMIT 0, $Max_Ban";
$Selection = mysql_query($sql);
$Rang=1;
$total = mysql_num_rows($Selection);
if ($total == 0) echo"<tr><td colspan=4><span class=\"description\"><center><b>Aucune bannière pour le moment<b></span></center></td></tr>";

while ($Article=mysql_fetch_object($Selection))
{
?>
<tr>
<td width='5%' background="<?php echo $background_tableau_contenu; ?>"><center><span class="description"><?php echo $Rang; ?></span></center></td>
<td width='60%' background="<?php echo $background_tableau_contenu; ?>"><center><a href="Compteur_hits.php?id=<?php echo $Article->id; ?>" target="_blanck"><?php echo $Article->Nom_site; ?><br>



Like that the fetch_object thing does not work

Louis Cloutier