Error unexpected $

Eléphant du PHP | 450 Messages

24 juin 2005, 11:10

Bonjour ,

J'aurais aimé savoir ce que signifiais cette erreur

unexpected $

de meme je me demandais ou je pouvais trouver la signication de chacune des erreurs (comme sa sa m'éviterais de vous embeter pour sa a chaque fois :) )
lol
merci :lol: :lol:
Alone in the dark , I smile :D

Eléphant du PHP | 450 Messages

24 juin 2005, 11:20

Bon je vais vous donner mon code puisque je sait toujours pas se que sa signifie :)
lol
<? ..................

// connection à la DB
$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());


$id =$_GET['id'];

$select = "SELECT * FROM produit2 WHERE reference LIKE '$id'";
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$row = mysql_fetch_assoc($result);

$nom = $row['nom'];
$formule = $row['formule'];
$reference = $row['reference'];
$num = $row['numero_cass'];
$toxicite = $row['toxicite'];
$localisation = $row['localisation'];
$disponibilite = $row['disponibilite'];
$quantite = $row['quantite'];


$nom2 = $_POST['nom'];
$formule2 = $_POST['formule'];
$reference2 = $_POST['reference'];
$num2 = $_POST['numero_cass'];
$toxicite2 = $_POST['toxicite'];
$localisation2 = $_POST['localisation'];
$disponibilite2 = $_POST['disponibilite'];
$quantite2 = $_POST['quantite'];
$numero_cass2 = $_POST['numero_cass'];

if(isset($_POST['envoi']))

{

	if ($nom == '' || $formule == '' || $localisation == '' || $quantite == '' || $reference == '' || $numero_cass == '')
	{
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
          <table summary="">
            <col width="250" title="titres" />
            <col width="15" title="oblige" />
            <col width="250" title="donnees" />
	    <col width="250" title="nouvelle_donnees" />

        <tr width="30%" height="15"><td><b>Nom de la molécule :</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['nom']; ?></b></td>
	<td><b><input type="text" name="nom"></b></td></tr>

        <tr width="30%" height="29"><td><b>Formule brute de la molecule:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['formule']; ?></b></td>
	<td><b><input type="text" name="formule"></b></td></tr>

        <tr width="30%" height="29"><td><b>Localisation de la Molécule:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['localisation']; ?></b></td>
	<td><b><input type="text" name="localisation"></b></td></tr>

        <tr width="30%" height="29"><td><b>Disponibilité :</b></td>
        <td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['disponibilite']; ?></b></td>
	<td><b><input type="text" name="disponibilite"></b></td></tr>

        <tr width="30%" height="15"><td><b>Quantité en reserve :</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['quantite']; ?></b></td>
	<td><b><input type="text" name="quantite"></b></td></tr>

        <tr width="30%" height="29"><td><b>Reference de la molecule:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['reference']; ?></b></td>
	<td><b><input type="text" name="reference"></b></td></tr>

        <tr width="30%" height="29"><td><b>Numero de CAS:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['numero_cass']; ?></b></td>
	<td><b><input type="text" name="numero_cass"></b></td></tr>

        <tr width="30%" height="29"><td><b>Toxicite :</b></td>
        <td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['toxicite']; ?></b></td>
	<td><b><input type="text" name="toxicite"></b></td></tr>        
        
        <tr><td colspan="4"><div style="text-align:center;"><input type="submit" class="verif" name="envoi" value="Envoyer" />&nbsp;
        <input type="reset" class="verif" value="Tout effacer" /><input type="submit" value="Imprimer" onclick="print();">
        <input type="submit" value="fermer" onClick="window.close()";></div></td></tr>
        
        </TABLE></form>   

<?php
		}
		else{




/* Affichage du message final des informations reçues */
				print "<h3>Merci ! Voici les modifications que vous avez fournies pour cette molécule</h3>\n";
				print "<p>Informations sur la nouvelle molecule:</p>\n";
				print "<b>Son nom :</b>".$nom2."<br />\n";
				print "<b>Sa formule Brute :</b>".$formule2."<br />\n";
				print "<b>Sa localisation :</b>".$localisation2."<br />\n";
				print "<b>Sa quantite en reserve :</b>".$quantite2."<br />\n";
				print "<b>Sa reference :</b>".$reference2."<br />\n";
				print "<b>Son numero de CASE :</b>".$numero_cass2."<br />\n";
			if ($toxicite !==''){
				print "<b>Sa toxicite s'il y en a une :</b> ".$toxicite2."<br />\n";
					}	
        print("<p>Retour vers le formulaire de recherche pour modification, cliquez <a href=\"modification.php\" title=\"Retour vers le formulaire\">ICI</a></p>");
	print("<p>Retour vers l'Index, cliquez <a href=\"index.html\" title=\"Retour a l'index\">ICI</a></p>");
			

		}
	}
/* Si cette page s'ouvre pour la première fois sans que le bouton soumettant le formulaire n'ait 
   été cliqué, alors on affiche le formulaire normalement */
else
	{
?>
<H3><strong>Formulaire de modification de produits</strong></H3>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
          <table summary="">
            <col width="250" title="titres" />
            <col width="15" title="oblige" />
            <col width="250" title="donnees" />
	    <col width="250" title="nouvelle_donnees" />

        <tr width="30%" height="15"><td><b>Nom de la molécule :</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['nom']; ?></b></td>
	<td><b><input type="text" name="nom"></b></td></tr>

        <tr width="30%" height="29"><td><b>Formule brute de la molecule:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['formule']; ?></b></td>
	<td><b><input type="text" name="formule"></b></td></tr>

        <tr width="30%" height="29"><td><b>Localisation de la Molécule:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['localisation']; ?></b></td>
	<td><b><input type="text" name="localisation"></b></td></tr>

        <tr width="30%" height="29"><td><b>Disponibilité :</b></td>
        <td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['disponibilite']; ?></b></td>
	<td><b><input type="text" name="disponibilite"></b></td></tr>

        <tr width="30%" height="15"><td><b>Quantité en reserve :</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['quantite']; ?></b></td>
	<td><b><input type="text" name="quantite"></b></td></tr>

        <tr width="30%" height="29"><td><b>Reference de la molecule:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['reference']; ?></b></td>
	<td><b><input type="text" name="reference"></b></td></tr>

        <tr width="30%" height="29"><td><b>Numero de CAS:</td>
        <td><div style="color: #ff0000; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['numero_cass']; ?></b></td>
	<td><b><input type="text" name="numero_cass"></b></td></tr>

        <tr width="30%" height="29"><td><b>Toxicite :</b></td>
        <td><div style="color: #ffffff; text-align: center; font-weight: bold"></div></td>
        <td><b><?php print $row['toxicite']; ?></b></td>
	<td><b><input type="text" name="toxicite"></b></td></tr>        
        
        <tr><td colspan="4"><div style="text-align:center;"><input type="submit" class="verif" name="envoi" value="Envoyer" />&nbsp;
        <input type="reset" class="verif" value="Tout effacer" /><input type="submit" value="Imprimer" onclick="print();">
        <input type="submit" value="fermer" onClick="window.close()";></div></td></tr>
        
</TABLE>
</form> 
<?php

	}

?>
Alone in the dark , I smile :D

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 13231 Messages

24 juin 2005, 11:23

unexpected signifie qu'il n'attend pas ce caractère

généralement, c'est parce que tu as oublié de mettre un point virgule à la ligne d'avant celle indiquée dans le message d'erreur

Si tu veux la résoudre à coup sûr, tu regarde à la ligne donnée par le message d'erreur, tu trouve le caractère incriminé et l'erreur se trouve avant ce caractère
Connaître son ignorance est la meilleure part de la connaissance
Pour un code lisible : n'hésitez pas à sauter des lignes et indenter

twitter - site perso - Github - Zend Certified Engineer

Eléphant du PHP | 450 Messages

24 juin 2005, 11:23

C'est bon j'ai reparer et réediter mon code au dessus

ps: j'avais juste oublié une une balise d'ouverture de php..

:lol: :lol:
Alone in the dark , I smile :D

Eléphant du PHP | 450 Messages

24 juin 2005, 11:24

Merci Zeus mais j'avais trouver tout seul :p :p

(ps: il est pas mal ton avatar ;) )
Alone in the dark , I smile :D

Modérateur PHPfrance
Modérateur PHPfrance | 6373 Messages

24 juin 2005, 11:28

de meme je me demandais ou je pouvais trouver la signication de chacune des erreurs
ce petit truc est pas mal : http://www.nexen.net/erreurs/

liste pas mal d'erreurs et permet de faire une recherche sur le contenu du message

Eléphant du PHP | 450 Messages

24 juin 2005, 11:50

Merci oukileou :wink:

sa me permettra de moins vous embeter ;)
Alone in the dark , I smile :D