Dificulté avec update
andyra42
Messages postés
6
Statut
Membre
-
jordane45 Messages postés 30651 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 30651 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
J'ai un problème au niveau du fichier modifierEtudiant.php, si je veux faire un update on m'affiche: Notice: Undefined index: code in C:/wamp/www/gestionEtudiant/modifierEtudiant.php on line 3 You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server version for the right syntax to use near " at line 1
voici le fichier modifierEtudiant.php:
J'ai un problème au niveau du fichier modifierEtudiant.php, si je veux faire un update on m'affiche: Notice: Undefined index: code in C:/wamp/www/gestionEtudiant/modifierEtudiant.php on line 3 You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server version for the right syntax to use near " at line 1
voici le fichier modifierEtudiant.php:
<?php
require_once ("check1.php");
require_once ("check2.php");
require_once("connection.php");
$code=$_POST['code'];
$nom=$_POST['nom'];
$email=$_POST['email'];
$photo=$_FILES['photo']['name'];
$file_tmp_name=$_FILES['photo']['tmp_name'];
move_uploaded_file($file_tmp_name,"./img/$photo");
$req="update etudiant set nom='$nom',email='$email',photo='$photo' where code=$code";
mysql_query($req) or die(mysql_error());
require_once ("afficher.php");
?>
| EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici : ICI Merci d'y penser dans tes prochains messages. |
A voir également:
- Dificulté avec update
- Winget update - Guide
- Windows update bloqué - Guide
- Asus live update - Télécharger - Utilitaires
- Wsus offline update - Télécharger - Systèmes d'exploitation
- Windows update windows 10 - Guide
3 réponses
Bonjour,
Pour éviter les soucis de variables "undefined" il est préférable de récupérer "proprement" ces variables via l'écriture TERNAIRE et un ISSET.
Ce qui donnerait par exemple :
Pour éviter les soucis de variables "undefined" il est préférable de récupérer "proprement" ces variables via l'écriture TERNAIRE et un ISSET.
Ce qui donnerait par exemple :
$code = isset($_POST['code']) ? $_POST['code'] : ''; $nom = isset($_POST['nom']) ? $_POST['nom'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : '';
ça me renvoi encore ça
Notice: Undefined index: code in C:\wamp\www\gest_et\modifier.php on line 5
update etudiant set nom='jj',email='[email protected]',photo='Koala.jpg' where code=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Notice: Undefined index: code in C:\wamp\www\gest_et\modifier.php on line 5
update etudiant set nom='jj',email='[email protected]',photo='Koala.jpg' where code=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Bonjour ça me renvoi encore ça:
Notice: Undefined index: code in C:\wamp\www\gest_et\modifier.php on line 5
update etudiant set nom='jj',email='[email protected]',photo='Koala.jpg' where code=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Notice: Undefined index: code in C:\wamp\www\gest_et\modifier.php on line 5
update etudiant set nom='jj',email='[email protected]',photo='Koala.jpg' where code=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Notice: Undefined index: code in C:\wamp\www\gest_et\modifier.php on line 5
update etudiant set nom='jj',email='[email protected]',photo='Koala.jpg' where code=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Si non, il faut mettre les quotes pour signifier une chaine.
Fais voir ton formulaire HTML