et j'ai une erreur qui est Query was empty
a priori se serai un problème de requête.
voici mon script
<?php
$annoncesparpages=2;
include 'php/connect.php';
$retour_total=mysql_query("SELECT COUNT (*) AS total FROM annonces WHERE categorie = 'vehicules'");
$retour_total = mysql_query($retour_total) or exit(mysql_error());
$donnees_total=mysql_fetch_assoc($retour_total);
$total=$donnees_total['total'];
$nombredepages=ceil($total/$annoncesparpages);
if(isset($_GET['pages']))
{
$pagesactuelle=intval($_GET['pages']);
if($pagesactuelle>$nombredepages)
{
$pagesactuelle=$nombredepages;
}
}
else
{
$pageactuelle=1;
}
$premiereentree=($pageactuelle-1)*$annoncesparpages;
$retourannonce=mysql_query("SELECT annonces.region , annonces.titreannonce , annonces.descriptionannonce , annonces.numannonce , annonces.prix , annonces.date , images.miniature, images.id_img
FROM annonces
LEFT JOIN images ON images.numannonce = annonces.numannonce
WHERE annonces.categorie = 'vehicules'
ORDER BY date DESC '.$premiereentree.', '.$annoncesparpages.'");
$retourannonce = mysql_query($retourannonce) or exit(mysql_error());
while($data=mysql_fetch_assoc($retourannonce))
$numannonce=$data['numannonce']
?>
<table>
<tr>
<td class="titreannonce" colspan="2"><a href="agrandissementannonces.php?numannonce=<?php echo $numannonce ?>"><?php echo $data ['titreannonce']; ?></a></td>
</tr>
<tr>
<td class="region"><?php echo $data ['region']; ?></td>
<td class="prix"><?php echo $data ['prix'],'€'; ?></td>
</tr>
<tr>
<td class="miniature"><img src="<?php echo substr($data['miniature'],24); ?>"/></td>
<?php
$descriptionannonce = $data ['descriptionannonce'];
$descriptionannonce = substr($descriptionannonce, 0, 100 );
echo '<td class="description" >' . $descriptionannonce,'...' . '</td>';
?>
</tr>
<tr>
<td class="date"><?php echo $data ['date']; ?></td>
<td class="pseudo"><?php echo $data ['pseudo']; ?></td>
</tr>
</table>
<?php
echo '<p align="center">Pages : '; //Pour l'affichage, on centre la liste des pagess
for($i=1; $i<=$nombredepages; $i++) //On fait notre boucle
{
//On va faire notre condition
if($i==$pagesactuelle) //Si il s'agit de la pages actuelle...
{
echo ' [ '.$i.' ] ';
}
else //Sinon...
{
echo ' <a href="paginationtest.php?pages='.$i.'">'.$i.'</a> ';
}
}
echo '</p>';
?>
Pouvez vous m'aider s'il vous plait merci d'avanceIl y a de l'évolution petit probléme de requete maintenant j'ai erreur
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #3' at line 1