Au secour erreur php
Résolu
bretonm2004
Messages postés
319
Date d'inscription
Statut
Membre
Dernière intervention
-
lezao Messages postés 469 Date d'inscription Statut Membre Dernière intervention -
lezao Messages postés 469 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je vient d'ajouter une ligne de code et j'ai eu une erreur Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/auto7837/public_html/rechercheavendre.php on line 305
sur internet il semblent dire que ca vient des double quotes
voici mon code la partie en gras est l'erreur
<?
mysql_connect('localhost', 'xxxx', 'xxx');
mysql_select_db("xxxx");
$sql = "SELECT * FROM avendrepubliee";
$req = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($req))
{
$id=$row['id']; $typedannonce=$row['typedannonce'];
$marque=$row['marque']; $autres=$row['autres'];
$modele=$row['modele']; $prix=$row['prix'];
$negociable=$row['negociable']; $annee=$row['annee'];
$etat=$row['etat']; $carburant=$row['carburant'];
$kilometrage=$row['kilometrage']; $transmission=$row['transmission'];
$immatricule=$row['immatricule']; $climatisation=$row['climatisation'];
$audio=$row['audio']; $cylindre=$row['cylindre'];
$puissance=$row['puissance']; $consommation=$row['consommation'];
$couleurinterieure=$row['couleurinterieure']; $couleurexterieure=$row['couleurexterieure'];
$email=$row['email']; $message=$row['message']; $date=$row['date']; $image=$row['image'];
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
if($row['image'.$i]) {
echo '<center>
<a href="photos/avendrenp/'.$row['image'.$i].'" alt="Voir image en grand">
<img src="photos/avendrenp/'.$row['image'.$i].' " width="300" />
</a>
</center>'; </td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
}
?>
je vient d'ajouter une ligne de code et j'ai eu une erreur Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/auto7837/public_html/rechercheavendre.php on line 305
sur internet il semblent dire que ca vient des double quotes
voici mon code la partie en gras est l'erreur
<?
mysql_connect('localhost', 'xxxx', 'xxx');
mysql_select_db("xxxx");
$sql = "SELECT * FROM avendrepubliee";
$req = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($req))
{
$id=$row['id']; $typedannonce=$row['typedannonce'];
$marque=$row['marque']; $autres=$row['autres'];
$modele=$row['modele']; $prix=$row['prix'];
$negociable=$row['negociable']; $annee=$row['annee'];
$etat=$row['etat']; $carburant=$row['carburant'];
$kilometrage=$row['kilometrage']; $transmission=$row['transmission'];
$immatricule=$row['immatricule']; $climatisation=$row['climatisation'];
$audio=$row['audio']; $cylindre=$row['cylindre'];
$puissance=$row['puissance']; $consommation=$row['consommation'];
$couleurinterieure=$row['couleurinterieure']; $couleurexterieure=$row['couleurexterieure'];
$email=$row['email']; $message=$row['message']; $date=$row['date']; $image=$row['image'];
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
if($row['image'.$i]) {
echo '<center>
<a href="photos/avendrenp/'.$row['image'.$i].'" alt="Voir image en grand">
<img src="photos/avendrenp/'.$row['image'.$i].' " width="300" />
</a>
</center>'; </td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
}
?>
A voir également:
- Au secour erreur php
- Erreur 0x80070643 - Accueil - Windows
- Expert php pinterest - Télécharger - Langages
- J'aime par erreur facebook notification - Forum Facebook
- Code erreur f3500-31 ✓ - Forum Bbox Bouygues
- Java code erreur 1603 ✓ - Forum Windows
3 réponses
Voila c'est pret tout chaud sortie du four tu comprend mieux maintenant ce que je veux dire, tu vas voir ça marche !?
<?
mysql_connect('localhost', 'xxxxxx', 'xxxxx');
mysql_select_db("fffffff");
$sql = "SELECT * FROM avendrepubliee";
$req = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($req))
{
$id=$row['id']; $typedannonce=$row['typedannonce'];
$marque=$row['marque']; $autres=$row['autres'];
$modele=$row['modele']; $prix=$row['prix'];
$negociable=$row['negociable']; $annee=$row['annee'];
$etat=$row['etat']; $carburant=$row['carburant'];
$kilometrage=$row['kilometrage']; $transmission=$row['transmission'];
$immatricule=$row['immatricule']; $climatisation=$row['climatisation'];
$audio=$row['audio']; $cylindre=$row['cylindre'];
$puissance=$row['puissance']; $consommation=$row['consommation'];
$couleurinterieure=$row['couleurinterieure']; $couleurexterieure=$row['couleurexterieure'];
$email=$row['email']; $message=$row['message']; $date=$row['date']; $image=$row['image'];
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
<center>
<a href='photos/avendrenp/".$row['image1']." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image1']." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr></tr>
</table> ";
}
?>
<p> </p>
lezao : quand tu sais pas , tu me demandes je sais tout....non je déconne...presque tout.
<?
mysql_connect('localhost', 'xxxxxx', 'xxxxx');
mysql_select_db("fffffff");
$sql = "SELECT * FROM avendrepubliee";
$req = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($req))
{
$id=$row['id']; $typedannonce=$row['typedannonce'];
$marque=$row['marque']; $autres=$row['autres'];
$modele=$row['modele']; $prix=$row['prix'];
$negociable=$row['negociable']; $annee=$row['annee'];
$etat=$row['etat']; $carburant=$row['carburant'];
$kilometrage=$row['kilometrage']; $transmission=$row['transmission'];
$immatricule=$row['immatricule']; $climatisation=$row['climatisation'];
$audio=$row['audio']; $cylindre=$row['cylindre'];
$puissance=$row['puissance']; $consommation=$row['consommation'];
$couleurinterieure=$row['couleurinterieure']; $couleurexterieure=$row['couleurexterieure'];
$email=$row['email']; $message=$row['message']; $date=$row['date']; $image=$row['image'];
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
<center>
<a href='photos/avendrenp/".$row['image1']." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image1']." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr></tr>
</table> ";
}
?>
<p> </p>
lezao : quand tu sais pas , tu me demandes je sais tout....non je déconne...presque tout.
Il n'y a pas pas qu'une erreur !
echo non fermé :
echo fermé trop tôt
et là, il en manque...
<blockquote cite="Shakespeare">To be or not to be ; That is the question...</blockquote>
echo non fermé :
echo "<table align='center' width='700' border='0'> <tr> <td width='114'>
echo fermé trop tôt
</center>'; </td>
et là, il en manque...
<td align='center' width='147'>".$prix."</td> <td align='center' width='153'>".$date."</td>
<blockquote cite="Shakespeare">To be or not to be ; That is the question...</blockquote>
je ne suis pas sur que tu comprend le probleme ou la situation dans le fond c'est un site d'annonce classé et il affiche une previsualisation de chaque annonce avec une image tout marche bien sauf quand j'introduit l'image peut-etre j'introduit mal l'image dans le code le echo fait apparaitre un tableau avec tout les informations
Notobe a raison c'est un probleme de echo non fermé :
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
if($row['image'.$i]) {
<center>
<a href='photos/avendrenp/".$row['image'.$i]." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image'.$i]." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
et pas : ----------------------------------------------CECI :
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
if($row['image'.$i]) {
echo '<center>
<a href="photos/avendrenp/'.$row['image'.$i].'" alt="Voir image en grand">
<img src="photos/avendrenp/'.$row['image'.$i].' " width="300" />
</a>
</center>'; </td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
lezao : quand tu sais pas , tu me demandes je sais tout....non je déconne...presque tout.
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
if($row['image'.$i]) {
<center>
<a href='photos/avendrenp/".$row['image'.$i]." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image'.$i]." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
et pas : ----------------------------------------------CECI :
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
if($row['image'.$i]) {
echo '<center>
<a href="photos/avendrenp/'.$row['image'.$i].'" alt="Voir image en grand">
<img src="photos/avendrenp/'.$row['image'.$i].' " width="300" />
</a>
</center>'; </td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
lezao : quand tu sais pas , tu me demandes je sais tout....non je déconne...presque tout.
Il ne faut pas melanger double guillement et simple guillement, de plus tu mets deux echo, c'est un foutoir absolu, on ouvre avec double guillement et on ferme avec double guillemet et point virgule, tout ce qui se trouve a l'interieur du echo doit etre en simple guillemet ou avec un point pour coller la chaine.
De plus apres avoir réparé ça tuvas avoir un nouveau probleme car mettre une variable d'incrementation sur 1 dans une boucle while ça va etre dur :
$i=1;
Doit etre en dehors de ta boucle while...et c'est pas tout au niveau incrémentation tu va galerer je pense , c'est pas tres net tout ça.... tu ne dois pas mettre de numero de champ image dans une boucle qui affiche elle meme le champ ? ça ne veut rien dire, bonne chance en tout cas lol.
$i=1;
Doit etre en dehors de ta boucle while...et c'est pas tout au niveau incrémentation tu va galerer je pense , c'est pas tres net tout ça.... tu ne dois pas mettre de numero de champ image dans une boucle qui affiche elle meme le champ ? ça ne veut rien dire, bonne chance en tout cas lol.
merci ca avance il me reste une erreur la voici Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/auto7837/public_html/rechercheavendre.php on line 304
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
--> ligne 304 if($row['image'.$i]) {
<center>
<a href='photos/avendrenp/".$row['image'.$i]." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image'.$i]." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
$i=1;
--> ligne 304 if($row['image'.$i]) {
<center>
<a href='photos/avendrenp/".$row['image'.$i]." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image'.$i]." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
Pourquoi deux fois :
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
c'est une erreur de frappe ou ton code est comme ça ? elle est pas la ton erreur ?
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr>";
c'est une erreur de frappe ou ton code est comme ça ? elle est pas la ton erreur ?
qu'est ce que tu as modifier que je comprenne mieux
tu me sauve la peau merci beraucoup
résolu :D:D
En fait une variable d'incrementation sert a a incrementer soit a additioner 1 a chaque passage de ligne donc inutile dans ton cas, quand tu appele un champ tu donnes le nom du champ exemple champ image1 s'appelle champ "image 1"
SQL passe chaque ligne en vue, grace a la boucle while donc il suffit de donner le nom du champ pour qu'il sa'ffiche, mais tu avais des erreurs de syntax aussi, tu as mis une condition de type if($row : ) ça ne veut rien dire en programation, donc le systeme est devenu fou !
Je te conseille de lire des tutoriaux tres simple comme les conditions, l'incrémentation et les requettes SQL.
Bon courage a toi et continues le php c'est génial !
Voici le code avec le TR du tableau rentré au sinon ça va etre mauche :
<?
mysql_connect('localhost', 'xxxxxx', 'xxxxx');
mysql_select_db("fffffff");
$sql = "SELECT * FROM avendrepubliee";
$req = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($req))
{
$id=$row['id']; $typedannonce=$row['typedannonce'];
$marque=$row['marque']; $autres=$row['autres'];
$modele=$row['modele']; $prix=$row['prix'];
$negociable=$row['negociable']; $annee=$row['annee'];
$etat=$row['etat']; $carburant=$row['carburant'];
$kilometrage=$row['kilometrage']; $transmission=$row['transmission'];
$immatricule=$row['immatricule']; $climatisation=$row['climatisation'];
$audio=$row['audio']; $cylindre=$row['cylindre'];
$puissance=$row['puissance']; $consommation=$row['consommation'];
$couleurinterieure=$row['couleurinterieure']; $couleurexterieure=$row['couleurexterieure'];
$email=$row['email']; $message=$row['message']; $date=$row['date']; $image=$row['image'];
echo "<table align='center' width='700' border='0'>
<tr>
<td width='114'>
<center>
<a href='photos/avendrenp/".$row['image1']." ' alt='Voir image en grand'>
<img src='photos/avendrenp/".$row['image1']." ' width='300' />
</a>
</center></td>
<td width='258' height='78'> </td>
<td align='center' width='147'>".$prix."</td>
<td align='center' width='153'>".$date."</td>
</tr></tr>
</table> ";
}
?>