i will not use php ever, I will use mysql stuff to add time and date
insert into table1 (col1,col2,today_date,today_datetime) values ('col1value','col2value',current_date(),current_timestamp())
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24
try without braces
current_date, current_timestamp
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24
it does print eg 2012-12-09 03:34:25. but i cant seem to store in database
What is the format of the field you want to store the value into?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'time())' at line 4
PHP functions can not be parsed within a double quoted string (as far as I know). Assign a value to a variable first and then use this variable in a query.
$temp_time = date('Y-m-d H:i:s',time());
$sql = mysql_query("INSERT INTO item
(image_user_name, image_folder_name, main_category, sub_category, price, description, features, key_words, sold, item_add_date)
VALUES('$image_user_name_p', '$image_folder_name','$main_category_p','$sub_category_p',
'$price_p','$description_p','$feature_p','$key_word_p', '0' , '$temp_time')")
or die(mysql_error()); //date() //date,timestamp
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24