0

HI,

THNX FOR HELPING IN MY LAST POST.

Now i wants the help in follwing problems.


i have a table in my sql named as "retailer001". i have a php page that have the
data entry form of all field that are in mysql table.

my table retailer001 having 11 fields (S No, Outlet ID,Date, Time ....... so on)
S No column has auto increment value and also primary key.
i have the php page which have the data entry form of 10 text field without the S NO
because the S No having auto increment and Null value.
In php data entry form i manually enter the date and time. i want help in that process. can any one
help me how can i enter the date and time in date and time column from system time automatically.

in clear words i want that i can't enter the date and time in data entry form. i want date
and time automatically insert into date and time column when i save or insert the remainings data.

please please please
please help me

3
Contributors
2
Replies
7
Views
7 Years
Discussion Span
Last Post by kamran_FrizCon
0

You can insert the current datetime by using NOW() when you actually update the table, something like this:

$insquery=mysql_query("INSERT INTO $tbl_name(field1,field2,created_at) 
	                     VALUES('a','b',NOW())" );

That means you need to have a DATETIME type column in your table ("created_at" in my example) which will be automatically be updated to the current date and time each time you insert a row in the table.

0

its simple

when u r inserting date and time ,in date and time field (insert query) write thos keyword '".date('Y-m-d')."' like

$sql = "insert into table (name,addDate) values ('$name','".date('Y-m-d')."')";


this will insert date in database now to ad time stamp you can write this

date('Y-m-d H:i:s' )( check format )

for further reference check this

http://www.w3schools.com/php/func_date_date.asp

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.