problem statement--> I want to insert date and time in mysql database using php
and want to display the time date and year in the post.
I already created date column in database
where i kept data type as date and time
here is my code
html submisssion form
<html> <body> <form action="pdt.php" method="post"> <input type="text" name="name"> <input type="submit" value="submit"> </form> </body> </html>
--------------php process script----------------
<?php
include('connect.php');
$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$phpdate = strtotime( $mysqldate );
$name=$_POST['name'];
$query = "UPDATE datetime SET date= FROM_UNIXTIME($phpdate)";
$exe=mysql_query($query);
if($exe==1)
{
echo "sucess";
}
else{
echo mysql_error();
}
?>
thank you in advance
This post has been edited by JackOfAllTrades: 26 February 2010 - 07:34 AM
Reason for edit:: Added code tags. PLEASE!!! [code]...PUT YOUR CODE IN HERE...[/code]

New Topic/Question
Reply




MultiQuote





|