PHP divides date instead of saving it as string
I have a MySQL database table that has a VARCHAR field storing a date in dd/mm/yyyy format.

I have a situation where I need to extract that date to a variable and then save it in a different table (which has a different structure than the first one).

So I do this:

    $result=mysql_query("select * from shares") or die(mysql_error());
    $row=mysql_fetch_array($result);
    $date_old=$row['last_update'];    //date in dd/mm/yyyy format

Then when I try to insert `$date_old` into the other table, instead of inserting the date, PHP actually performs a mathematical division operation on it! So instead of saving 14/03/2012, it divides 14 by 3 and then by 2012 and stores 0.0023 in the database.

Surely there is a way to stop this from happening using a built-in function (without removing the slashes from the string and then putting them back in before insertion)?
PHP divides date instead of saving it as string
===

I have a MySQL database table that has a VARCHAR field storing a date in dd/mm/yyyy format.

I have a situation where I need to extract that date to a variable and then save it in a different table (which has a different structure than the first one).

So I do this:

    $result=mysql_query("select * from shares") or die(mysql_error());
    $row=mysql_fetch_array($result);
    $date_old=$row['last_update'];    //date in dd/mm/yyyy format

Then when I try to insert `$date_old` into the other table, instead of inserting the date, PHP actually performs a mathematical division operation on it! So instead of saving 14/03/2012, it divides 14 by 3 and then by 2012 and stores 0.0023 in the database.

Surely there is a way to stop this from happening using a built-in function (without removing the slashes from the string and then putting them back in before insertion)?