par
Skinsnapper » 19 mars 2006, 23:21
Bonjour ! J'ai un problème avec un script sur mon site et sa me dit l'erreur suivante: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
Voici mon script et la phrase en gras c'est la 28eme ligne puisqu'il y a un bout de script avant mais que je ne préfère pas afficher.
<?
// lancement de la requête (on impose aucune condition puisque l'on désire obtenir la liste complète des propriétaires
$sql = 'SELECT * FROM news ORDER BY date DESC LIMIT 0 , 6';
// on lance la requête (mysql_query) et on impose un message d'erreur si la requête ne se passe pas bien (or die)
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$x = 0;
while ($data = mysql_fetch_array($req)) {
$y = $x++;
if ($y = 1 || $y = 3 || $y = 5) {
// On teste pour voir si nos variables ont bien été enregistrées
echo'<table cellpadding="0" cellspacing="0" width="408">';
echo'<tr>';
echo'<td width="408" bgcolor="#A9DC53">';
echo'<p>'.$data['date'].';
echo'<a href="./lire_sujet.php?lire_news=' , $data['id'] , '">' , stripslashes(htmlentities(trim($data['titre']))) , '</a></p>';
echo'</td>';
echo'</tr>';
echo'</table>';
}
else {
echo'<table cellpadding="0" cellspacing="0" width="408">';
echo'<tr>';
echo'<td width="408" bgcolor="#82AB43">';
echo'<p>'.$data['date'].';
echo'<a href="./lire_sujet.php?lire_news=' , $data['id'] , '">' , stripslashes(htmlentities(trim($data['titre']))) , '</a></p>';
echo'</td>';
echo'</tr>';
echo'</table>';
}
}
mysql_free_result ($req);
mysql_close ();
?>
</body>
</html>
Pouvez-vous me guider pour savoir ou est mon erreur ?
Merci
Bonjour ! J'ai un problème avec un script sur mon site et sa me dit l'erreur suivante: Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
Voici mon script et la phrase en gras c'est la 28eme ligne puisqu'il y a un bout de script avant mais que je ne préfère pas afficher.
[quote]<?
// lancement de la requête (on impose aucune condition puisque l'on désire obtenir la liste complète des propriétaires
$sql = 'SELECT * FROM news ORDER BY date DESC LIMIT 0 , 6';
// on lance la requête (mysql_query) et on impose un message d'erreur si la requête ne se passe pas bien (or die)
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$x = 0;
while ($data = mysql_fetch_array($req)) {
$y = $x++;
if ($y = 1 || $y = 3 || $y = 5) {
// On teste pour voir si nos variables ont bien été enregistrées
echo'<table cellpadding="0" cellspacing="0" width="408">';
echo'<tr>';
echo'<td width="408" bgcolor="#A9DC53">';
echo'<p>'.$data['date'].';
[b]echo'<a href="./lire_sujet.php?lire_news=' , $data['id'] , '">' , stripslashes(htmlentities(trim($data['titre']))) , '</a></p>';[/b]
echo'</td>';
echo'</tr>';
echo'</table>';
}
else {
echo'<table cellpadding="0" cellspacing="0" width="408">';
echo'<tr>';
echo'<td width="408" bgcolor="#82AB43">';
echo'<p>'.$data['date'].';
echo'<a href="./lire_sujet.php?lire_news=' , $data['id'] , '">' , stripslashes(htmlentities(trim($data['titre']))) , '</a></p>';
echo'</td>';
echo'</tr>';
echo'</table>';
}
}
mysql_free_result ($req);
mysql_close ();
?>
</body>
</html>
[/quote]
Pouvez-vous me guider pour savoir ou est mon erreur ?
Merci