[PHP] Time stamp and changing to a date.
$mydate = 20030328231154; $myPrintDate=date (l dS of F Y h:i:s A,$mydate); echo $myPrintDate; Whats wrong -- Philip J. Newman. Head Developer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Time stamp and changing to a date.
$mydate = 20030328231154; $myPrintDate=date (l dS of F Y h:i:s A,$mydate); echo $myPrintDate; Whats wrong $mydate should be a unix style timestamp not a MMDDHHMMSS type date/time format... Check the functions time() and mktime() to help you generate unix timestamps. HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Time stamp and changing to a date.
?php $mydate = date(20030328231154); $myPrintDate=date (l dS of F Y h:i:s A,$mydate); echo $myPrintDate; ? On 28/3/03 11:44 am, Philip J. Newman [EMAIL PROTECTED] wrote: $mydate = 20030328231154; $myPrintDate=date (l dS of F Y h:i:s A,$mydate); echo $myPrintDate; Whats wrong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] time stamp screwing up
hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date ideas P.S I am a newbie try keeping reponse's simple please -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
What sort of mysql field type did you use for dateAdded ? You need UNIX_TIMESTAMP (or sth like that) for unix timestamp format. - [ Paul Ferrie ] - wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date ideas P.S I am a newbie try keeping reponse's simple please -- When ipv6 and tcpa are there.. When this Palladium server wrecks.. I won't be able to drink my coffe then! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
nope it still comes up with all the zero's :( Stephan Seidt [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What sort of mysql field type did you use for dateAdded ? You need UNIX_TIMESTAMP (or sth like that) for unix timestamp format. - [ Paul Ferrie ] - wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date ideas P.S I am a newbie try keeping reponse's simple please -- When ipv6 and tcpa are there.. When this Palladium server wrecks.. I won't be able to drink my coffe then! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
On Tuesday 07 January 2003 00:19, - \[ Paul Ferrie \] - wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date What column type is dateAdded? If it's a mysql DATE type then you should replace: '$time' with NOW() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's more than magnificent -- it's mediocre. -- Sam Goldwyn */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
So Jason what your saying is this $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); Should be $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', NOW()); ?? cheers Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tuesday 07 January 2003 00:19, - \[ Paul Ferrie \] - wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date What column type is dateAdded? If it's a mysql DATE type then you should replace: '$time' with NOW() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's more than magnificent -- it's mediocre. -- Sam Goldwyn */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
yep i guess that, so NOW() is a mysql function. - [ Paul Ferrie ] - wrote: So Jason what your saying is this $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); Should be $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', NOW()); ?? cheers Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tuesday 07 January 2003 00:19, - \[ Paul Ferrie \] - wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date What column type is dateAdded? If it's a mysql DATE type then you should replace: '$time' with NOW() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's more than magnificent -- it's mediocre. -- Sam Goldwyn */ -- When ipv6 and tcpa are there.. When this Palladium server wrecks.. I won't be able to drink my coffe then! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
On Tuesday 07 January 2003 00:49, - \[ Paul Ferrie \] - wrote: So Jason what your saying is this $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); Should be $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', NOW()); Yes. That'll insert mysql's notion of the current time into dateAdded. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* While having never invented a sin, I'm trying to perfect several. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
So Is NOW() a mysql function? Stephan Seidt [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... yep i guess that, so NOW() is a mysql function. - [ Paul Ferrie ] - wrote: So Jason what your saying is this $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); Should be $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', NOW()); ?? cheers Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tuesday 07 January 2003 00:19, - \[ Paul Ferrie \] - wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date What column type is dateAdded? If it's a mysql DATE type then you should replace: '$time' with NOW() -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's more than magnificent -- it's mediocre. -- Sam Goldwyn */ -- When ipv6 and tcpa are there.. When this Palladium server wrecks.. I won't be able to drink my coffe then! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
- [ Paul Ferrie ] - [EMAIL PROTECTED] wrote: So Is NOW() a mysql function? Well, you can check for yourself ;) It should be somewhere around here: http://www.mysql.com/doc/en/Date_and_time_functions.html - E ...[snip]... __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
Well i am still getting all the zero's : ( : ( - Edwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... - [ Paul Ferrie ] - [EMAIL PROTECTED] wrote: So Is NOW() a mysql function? Well, you can check for yourself ;) It should be somewhere around here: http://www.mysql.com/doc/en/Date_and_time_functions.html - E ...[snip]... __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] time stamp screwing up
show us your database table structure (the whole thing). the NOW() will always work with a date or timestamp field - Original Message - From: - [ Paul Ferrie ] - [EMAIL PROTECTED] To: Sent: Monday, January 06, 2003 11:28 AM Subject: Re: [PHP] time stamp screwing up Well i am still getting all the zero's : ( : ( - Edwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... - [ Paul Ferrie ] - [EMAIL PROTECTED] wrote: So Is NOW() a mysql function? Well, you can check for yourself ;) It should be somewhere around here: http://www.mysql.com/doc/en/Date_and_time_functions.html - E ...[snip]... __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time stamp screwing up
A MySQL timestamp is different to a MySQL timestamp. $time = time(); will produce a unix timestamp what you want is $time = date('Y-m-d'); to give a value in the format -MM-DD I think you can also use NOW(): $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', NOW()); ... but I've never tried -- loook up NOW() in the MySQL manual. IF you wanted the unix stamp instead (seconds since unix epoch), you should change the column type of dateAdded to an unsigned integer of 32 bits (from what I can tell from the manual). I personally prefer unix stamps (seconds) over formatted dates (-MM-DD) because it's easy to compare them and find out the difference (subtract one from the other), add a day (add 24*60*60) etc etc, BUT it's harder (impossible) for a human to read the raw data in the DB. Good luck, Justin French on 07/01/03 3:19 AM, - [ Paul Ferrie ] - ([EMAIL PROTECTED]) wrote: hey guys could someone help me I have created a user login register system in flash with PHP and Mysql. Everthing Now works fine aprt from the time stamp of when the user registered. Code --- // Get current date time $time = time(); // Connects to the Database. $Connect = mysql_connect($dbServer, $dbUser, $dbPass); mysql_select_db($dbName); // Preforms the SQL query to see if user name already exsists $query = SELECT name FROM contacts WHERE name='$name'; $rs_contacts = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($rs_contacts); if ($row[name] == $name) { print loginT=UserName in Usechecklog=2; }else{ $query = INSERT INTO contacts (id, name, pass, email, dateAdded) VALUES (NULL, '$name', '$pass', '$email', '$time'); } It inserts -00-00 instead of the current date ideas P.S I am a newbie try keeping reponse's simple please -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Time Stamp
Hi, I have a form that I am using to update a mysql table but I can get timestamp to update. How can I pass that information to pass on. I have READ all books and feel I have correct systax but it just not working... input type=text name=lastupdate value=? echo date('D M d, Y H:i:s', time()); ? This should pass the time right? Chuck Payne Magi Design and Support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Time Stamp
MySQL syntax is MMDDHHMMSS or -MM-DD HH:MM:SS ---John Holmes... - Original Message - From: Chuck Payne [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 18, 2002 11:25 AM Subject: [PHP] Time Stamp Hi, I have a form that I am using to update a mysql table but I can get timestamp to update. How can I pass that information to pass on. I have READ all books and feel I have correct systax but it just not working... input type=text name=lastupdate value=? echo date('D M d, Y H:i:s', time()); ? This should pass the time right? Chuck Payne Magi Design and Support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] time stamp
I am using PHP with MySQL and have a timestamp field in my db table. What would be the easiest way to get the newest timestamp out of the db? Thanks in Advance Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php