Jump to content

[SOLVED] Updating a date field


jim.davidson

Recommended Posts

I've been looking at this for the past couple of hours trying to figure out what I'm doing wrong, but I can't see it.

 

I'm trying to update a date of birth field in a table from user input but it doesn't update dob.  What am I doing wrong?

 

variable from input form

$dob = '10/15/1951'

 

  $ddate = explode('/', $dob);

  $sql_dob = "$ddate[2]-$ddate[0]-$ddate[1]";

 

 

Here's the php code to update

 

  $patientid = $_SESSION['patient_id'];

  $updateSQL = "UPDATE patient SET dob = $sql_dob WHERE patient_id = $patientid";

        mysql_select_db($database_pnurse, $pnurse);

        $Result1 = mysql_query($updateSQL, $pnurse) or die(mysql_error());

 

Here's the table info

 

Table patient

 

Field Type Null Default

dob date No 0000-00-00

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/74787-solved-updating-a-date-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.