Message d'erreur PHP: Parse error

Résolu/Fermé
mikacontact Messages postés 33 Date d'inscription mercredi 21 juillet 2004 Statut Membre Dernière intervention 23 avril 2007 - 6 déc. 2006 à 05:13
mikacontact Messages postés 33 Date d'inscription mercredi 21 juillet 2004 Statut Membre Dernière intervention 23 avril 2007 - 6 déc. 2006 à 10:01
Bonjour tout le monde.

Je rencontre le message d'erreur suivant en voulant executer ma page php dans un navigateur:

[B]Parse error: parse error, unexpected '&', expecting T_STRING or T_VARIABLE or '$' in C:\wamp\www\SITEboutique\Public\catalogue.php on line 10[/B]

Je vous met la ligne 10 en question ci-dessous:

[B]if (isset(&_GET['VARtitre'])) { // Ligne 10
$coltitre_rsCatalogue = (get_magic_quotes_gpc()) ? &_GET['VARtitre'] : addslashes(&_GET['VARtitre']);
}
$coltheme_rsCatalogue = "1";
if (isset(&_GET['VARtheme'])) {
$coltheme_rsCatalogue = (get_magic_quotes_gpc()) ? &_GET['VARtheme'] : addslashes(&_GET['VARtheme']);
}[/B]

Pour voir si ce pb vient bien de là, j'ai enlevé ces lignes, et la page s'affiche, donc l'erreur est bien là. Pour ceux qui vont me demander de vérifier si je suis bien en latin 1 sur ma base de donnée, la réponse est oui.

Je vous mets l'intégralité de mon code concernant cette page dans l'éventualité où ça puisse être nécessaire:

<?php require_once('../Connections/ConnexionBoutique.php'); ?>
<?php
mysql_select_db($database_ConnexionBoutique, $ConnexionBoutique);
$query_rsTheme = "SELECT * FROM rubriques ORDER BY categorie ASC";
$rsTheme = mysql_query($query_rsTheme, $ConnexionBoutique) or die(mysql_error());
$row_rsTheme = mysql_fetch_assoc($rsTheme);
$totalRows_rsTheme = mysql_num_rows($rsTheme);

$coltitre_rsCatalogue = "1";
if (isset(&_GET['VARtitre'])) {
$coltitre_rsCatalogue = (get_magic_quotes_gpc()) ? &_GET['VARtitre'] : addslashes(&_GET['VARtitre']);
}
$coltheme_rsCatalogue = "1";
if (isset(&_GET['VARtheme'])) {
$coltheme_rsCatalogue = (get_magic_quotes_gpc()) ? &_GET['VARtheme'] : addslashes(&_GET['VARtheme']);
}
mysql_select_db($database_ConnexionBoutique, $ConnexionBoutique);
$query_rsCatalogue = sprintf("SELECT articles.nom, articles.reference, articles.prix, rubriques.categorie FROM articles, rubriques WHERE articles.rubriqueID=%s AND rubriques.ID=articles.rubriqueID AND articles.nom like '%%%s%%'", $coltheme_rsCatalogue,$coltitre_rsCatalogue);
$rsCatalogue = mysql_query($query_rsCatalogue, $ConnexionBoutique) or die(mysql_error());
$row_rsCatalogue = mysql_fetch_assoc($rsCatalogue);
$totalRows_rsCatalogue = mysql_num_rows($rsCatalogue);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Modele Public.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>

<body>
<div align="center"><img src="../images/bandeauapublic.GIF" width="650" height="156" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="6,114,156,157" href="catalogue.php" />
<area shape="rect" coords="187,115,299,155" href="panier.php" />
<area shape="rect" coords="316,114,495,159" href="commande.php" /><area shape="rect" coords="529,114,642,160" href="../Administrateur/index.php" />
</map></div>
<table width="912" height="94" border="0" align="center">
<tr><!-- InstanceBeginEditable name="regionPublicModifiable" -->
<th scope="col"><form action="catalogue.php" method="get" enctype="multipart/form-data" name="formCatalogue" id="formCatalogue">
<label>Sélectionnez une catégorie:
<select name="VARtheme" id="VARtheme">
<?php
do {
?>
<option value="<?php echo $row_rsTheme['ID']?>"<?php if (!(strcmp($row_rsTheme['ID'], $_GET['VARtheme']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsTheme['categorie']?></option>
<?php
} while ($row_rsTheme = mysql_fetch_assoc($rsTheme));
$rows = mysql_num_rows($rsTheme);
if($rows > 0) {
mysql_data_seek($rsTheme, 0);
$row_rsTheme = mysql_fetch_assoc($rsTheme);
}
?>
</select>
</label>
ou saisissez le nom d'un produit:
<label>
<input name="VARtitre" type="text" id="VARtitre" />
</label>
<label></label>
<label>
<input type="submit" name="Submit" value="Afficher" />
</label>
<label></label>
</form>
<table width="857" border="2">
<tr>
<th bgcolor="#CCCC33" scope="col">Nom</th>
<th bgcolor="#CCCC33" scope="col">sRéférence</th>
<th bgcolor="#CCCC33" scope="col">Prix</th>
<th bgcolor="#CCCC33" scope="col">Catégorie</th>
</tr>
<tr>
<?php do { ?>
<td><a href="fiche.php?reference=<?php echo $row_rsCatalogue['reference']; ?>"><?php echo $row_rsCatalogue['nom']; ?></a></td>
<td><?php echo $row_rsCatalogue['reference']; ?></td>
<td><?php echo $row_rsCatalogue['prix']; ?></td>
<td><?php echo $row_rsCatalogue['categorie']; ?></td>
<?php } while ($row_rsCatalogue = mysql_fetch_assoc($rsCatalogue)); ?></tr>
<tr>
<td colspan="4"><div align="center">
<p>Sélectionnez une catégorie et éventuellement la marque d'un article et cliquez sur <span style="font-style: italic">Afficher.</span></p>
<p>Pour consulter la fiche d'un article, cliquez sur son Nom. </p>
</div></td>
</tr>
</table></th>
<!-- InstanceEndEditable --></tr>
</table>
<div align="center"><img src="../images/BarreBasPublic.GIF" width="649" height="18" />
</div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($rsTheme);

mysql_free_result($rsCatalogue);
?>


Merci pour votre aide.
Cordialement.
A voir également:

2 réponses

kij_82 Messages postés 4088 Date d'inscription jeudi 7 avril 2005 Statut Contributeur Dernière intervention 30 septembre 2013 857
6 déc. 2006 à 09:07
Ben je pense que si tu remplace tout tes :
&_GET['VARtitre']


par
$_GET['VARtitre']


ca devrait etre bon.
1
mikacontact Messages postés 33 Date d'inscription mercredi 21 juillet 2004 Statut Membre Dernière intervention 23 avril 2007 16
6 déc. 2006 à 10:01
Exacte! Je suis trop con! C'est fini je ne programme plus la nuit! J'ai cherché super longtemps mon erreur, mais j'avais plus les yeux en face des trous.
Merci bien ;)
0