-3

I have a problem I can not edit the field birthdate in my database .I need help please. this is the code.employees.php

    $Nom = mysql_real_escape_string($_POST["nom"]);
    $Id = mysql_real_escape_string($_POST["id"]);
    $Prenom = mysql_real_escape_string($_POST["prenom"]);
    $BirthDate = mysql_real_escape_string($_POST["birthdate"]);
    $rs = mysql_query(" UPDATE users SET nom = '" .$Nom ."', prenom = '" .$Prenom ."', birtdate = '" .$BirthDate."' WHERE id = " .$Id) or die(mysql_error());
    echo json_encode($rs);
HamZa
  • 14,671
  • 11
  • 54
  • 75
  • 6
    What error do you get? – Anthony Sterling May 12 '13 at 12:07
  • 2
    Maybe you forgot a double quote? `WHERE id = " .$Id.'"')` ? – HamZa May 12 '13 at 12:08
  • Welcome to Stack Overflow! [Please, don't use `mysql_*` functions](http://stackoverflow.com/q/12859942/1190388) in new code. They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). See the red box? Learn about prepared statements instead, and use [tag:PDO] or [tag:MySQLi]. – hjpotter92 May 12 '13 at 12:14

1 Answers1

2

Your query is referencing a field named birtdate, which according to your question and the spelling in the rest of your code should be birthdate

$rs = mysql_query("UPDATE users SET nom = '" .$Nom ."', prenom = '" .$Prenom ."', birthdate = '" .$BirthDate."' WHERE id = " .$Id) or die(mysql_error());
Moak
  • 12,596
  • 27
  • 111
  • 166