Parse error:syntax error,unexpected T_VARIABL
phpuser
Messages postés
64
Statut
Membre
-
phpuser Messages postés 64 Statut Membre -
phpuser Messages postés 64 Statut Membre -
Bonjour,
je voudrais faire la mise à jour d'une table de ma base de données,à partir du code
php,mais j'obtiens tjrs l'erreur(qui m'a fait horreeuuur) :
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\3-Structure\modifier.php on line 42
si qlq'1 pourait m'aider,je serais reconnaissant.
voici mon code (l'erreur est au niveau de la requete UPDATE):
<?php
$connexion=mysql_connect( "localhost" , "root" , "" );
mysql_select_db("parc_info");
$requete="SELECT * FROM user ";
$resultat=mysql_query($requete);
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>modifier compte</title>
</head>
<body>
<h1><p>PAGE COMPTE</p></h1>
<form id="monform" name="form1" method="post" action="modifier.php">
<p>
<label>
<input type="submit" name="bouton1" value="voir liste des compte" />
</label>
</p>
</form>
<form id="monform" name="form1" method="post" action="modifier.php">
<p>
<label><p>entrer id_user du compte à modifier :</p>
<input type="text" name="id" />
</label>
</p>
<p>
<label>
<input type="submit" name="bouton2" value="valider" />
</label>
</p>
</form>
<?php
if(isset($_POST['id'])){
echo ' id utilisateur :'.' '.$_POST['id'];
require("formuser.inc.php");
$requete2="UPDATE user SET nom_user = '".mysql_real_escape_string($_POST['nom_user'])."' WHERE id_user = '"$_POST['id']"'";
$resultat2=mysql_query($requete2);
}
?>
<?php
if(isset($_POST['bouton1'])){?>
<table width="600" border="1" cellspacing="0" cellpadding="5">
<tr>
<td>id_user</td>
<td>nom</td>
<td>prenom</td>
<td>pseudo</td>
<td>password</td>
<td>fonction</td>
</tr>
<?php while($article=mysql_fetch_array($resultat)) { ?>
<tr>
<td><?php echo $article['id_user']; ?></td>
<td><?php echo $article['nom_user']; ?></td>
<td><?php echo $article['prenom']; ?></td>
<td><?php echo $article['pseudo']; ?></td>
<td><?php echo $article['password']; ?></td>
<td><?php echo $article['fonction']; ?></td>
</tr>
<?php } ?>
</table>
<?php }?>
</body>
</html>
_____________________________________________
pour le formuser.inc.php le voila(mais je crois pas que c'est la le blem) :
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PAGE UTILISATEUR</title>
</head>
<body>
<form id="monform" name="form1" method="post" action="formuser.inc.php">
<p>
<label>nom utilisateur :
<input type="text" name="nom_user" />
</label>
</p>
<p>
<label>prenom utilisateur :
<input type="text" name="prenom" />
</label>
</p>
<p>
<label>pseudo:
<input type="text" name="pseudo" />
</label>
</p>
<p>
<label>password:
<input type="text" name="password" />
</label>
</p>
<p>
<label>fonction:
<input type="text" name="fonction" />
</label>
</p>
<p>
<label>
<input type="submit" name="bouton" value="confirmation" />
</label>
</p>
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>
</form>
<body>
</html>
je voudrais faire la mise à jour d'une table de ma base de données,à partir du code
php,mais j'obtiens tjrs l'erreur(qui m'a fait horreeuuur) :
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\3-Structure\modifier.php on line 42
si qlq'1 pourait m'aider,je serais reconnaissant.
voici mon code (l'erreur est au niveau de la requete UPDATE):
<?php
$connexion=mysql_connect( "localhost" , "root" , "" );
mysql_select_db("parc_info");
$requete="SELECT * FROM user ";
$resultat=mysql_query($requete);
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>modifier compte</title>
</head>
<body>
<h1><p>PAGE COMPTE</p></h1>
<form id="monform" name="form1" method="post" action="modifier.php">
<p>
<label>
<input type="submit" name="bouton1" value="voir liste des compte" />
</label>
</p>
</form>
<form id="monform" name="form1" method="post" action="modifier.php">
<p>
<label><p>entrer id_user du compte à modifier :</p>
<input type="text" name="id" />
</label>
</p>
<p>
<label>
<input type="submit" name="bouton2" value="valider" />
</label>
</p>
</form>
<?php
if(isset($_POST['id'])){
echo ' id utilisateur :'.' '.$_POST['id'];
require("formuser.inc.php");
$requete2="UPDATE user SET nom_user = '".mysql_real_escape_string($_POST['nom_user'])."' WHERE id_user = '"$_POST['id']"'";
$resultat2=mysql_query($requete2);
}
?>
<?php
if(isset($_POST['bouton1'])){?>
<table width="600" border="1" cellspacing="0" cellpadding="5">
<tr>
<td>id_user</td>
<td>nom</td>
<td>prenom</td>
<td>pseudo</td>
<td>password</td>
<td>fonction</td>
</tr>
<?php while($article=mysql_fetch_array($resultat)) { ?>
<tr>
<td><?php echo $article['id_user']; ?></td>
<td><?php echo $article['nom_user']; ?></td>
<td><?php echo $article['prenom']; ?></td>
<td><?php echo $article['pseudo']; ?></td>
<td><?php echo $article['password']; ?></td>
<td><?php echo $article['fonction']; ?></td>
</tr>
<?php } ?>
</table>
<?php }?>
</body>
</html>
_____________________________________________
pour le formuser.inc.php le voila(mais je crois pas que c'est la le blem) :
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PAGE UTILISATEUR</title>
</head>
<body>
<form id="monform" name="form1" method="post" action="formuser.inc.php">
<p>
<label>nom utilisateur :
<input type="text" name="nom_user" />
</label>
</p>
<p>
<label>prenom utilisateur :
<input type="text" name="prenom" />
</label>
</p>
<p>
<label>pseudo:
<input type="text" name="pseudo" />
</label>
</p>
<p>
<label>password:
<input type="text" name="password" />
</label>
</p>
<p>
<label>fonction:
<input type="text" name="fonction" />
</label>
</p>
<p>
<label>
<input type="submit" name="bouton" value="confirmation" />
</label>
</p>
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>
</form>
<body>
</html>
A voir également:
- Parse error:syntax error,unexpected T_VARIABL
- Fan error lenovo - Forum Refroidissement
- Eespt technical error - Forum Box et Streaming vidéo
- Pour ceux qui ont "LENOVO fan error au démarrage" - Forum PC portable
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- Network error iptv - Forum TV & Vidéo
1 réponse
Pourquoi nous donner tout ton html alors que tu sais d'où vient ton erreur ... ? Sinon, ça doit venir du $_POST ['id'], en concaténant ça devrait être bon :
$requete2="UPDATE user SET nom_user = '".mysql_real_escape_string($_POST['nom_user'])."' WHERE id_user = '".$_POST['id']."'";
phpuser
Messages postés
64
Statut
Membre
merci supersonic pour le coup de pouce :-)