Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » I need some PHP help! timestamp?
Closed Thread
Old 05-06-2009, 12:26 AM   #11 (permalink)
 
Newb Techie

Join Date: Mar 2009

Location: San Marcos CA

Posts: 15

Hereisfun is on a distinguished road

Send a message via AIM to Hereisfun
Default Re: I need some PHP help! timestamp?

So this should be the insert into:

PHP Code:
$query "INSERT INTO cmmnts2 (name, date, comment, email) " .
"VALUES ('$name', 'time()',  '$comment', '$email')"

Does the table stuff have to be in order?


And this should be the display?

PHP Code:
while ($row mysqli_fetch_array($sqlMYSQLI_ASSOC)) {
    echo 
'<b>Name:</b> '.$row['name'].'<br />
          <b>Comment:</b> '
.$row['comment'].'<br />
          <b>Email:</b> ' 
.$row['email'].'<br />
          <b><i><font color="#393939">Date Posted:</b></i> '
.date('M/d/Y h:i A'$row['date']).'<br /><br /></font>';

Ooo and im not sure if i used the font color the correct way..but it worked so oh well unless there is a better way..

With this code it still came out with the wrong date :/ Hmmph its probably somthing i did wrong :/
Hereisfun is offline  
Old 05-06-2009, 09:26 AM   #12 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: I need some PHP help! timestamp?

Try time() without the single quotes.

As for the order on the insert statement, if it is like this:
Code:
$query = "INSERT INTO cmmnts2 (name, date, comment, email) " . 
"VALUES ('$name', 'time()',  '$comment', '$email')";
then it is independant of the order of the fields in the table but if it is like this:
Code:
$query = "INSERT INTO cmmnts2 " . 
"VALUES ('$name', 'time()',  '$comment', '$email')";
then the values have to be in the same order as the fields in the table. You should ALWAYS use the first method.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is online now  
Old 05-06-2009, 01:57 PM   #13 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: I need some PHP help! timestamp?

PHP Code:
$query "INSERT INTO cmmnts2 (name, date, comment, email) " .
"VALUES ('$name', '".time()."',  '$comment', '$email')"
Try this.
__________________

Need website help? PM me!
CrazeD is offline  
Old 05-06-2009, 04:05 PM   #14 (permalink)
 
Newb Techie

Join Date: Mar 2009

Location: San Marcos CA

Posts: 15

Hereisfun is on a distinguished road

Send a message via AIM to Hereisfun
Default Re: I need some PHP help! timestamp?

It works
Thank you very much, again!!!
Hereisfun is offline  
Old 05-18-2009, 06:35 AM   #15 (permalink)
 
Newb Techie

Join Date: May 2009

Location: UK

Posts: 6

j.smith1981 is on a distinguished road

Send a message via MSN to j.smith1981
Lightbulb Re: I need some PHP help! timestamp?

As just general guidance notes PHP as a reference library of all functions on its website, use this link: PHP Time (related to timestamp) to get the timestamp format you require (as the same with MySQL, uses the Unix timestamp generally but thats obviously on the Linux/Unix system, dont know too much about Windows, but dont like running apache on Windows, isnt really suited for it)
j.smith1981 is offline  
Old 05-18-2009, 09:11 PM   #16 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: I need some PHP help! timestamp?

PHP still uses the UNIX timestamp on Windows. And you don't need Apache to use PHP on Windows, although Apache works absolutely fine on Windows.
__________________

Need website help? PM me!
CrazeD is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Guide to Installing Apache, PHP, MySQL, and PHPMyAdmin on Windows CrazeD Programming Discussions 17 06-17-2009 04:27 PM
How echo works in PHP Osiris Programming Discussions 0 03-04-2009 08:34 AM
PHP - what it does and what it doesn’t Osiris Programming Discussions 1 02-16-2009 04:09 PM
Wev Development: How does PHP work? Osiris Programming Discussions 1 01-08-2009 04:31 PM
Removing PHP For Increased Download Speed Rex100 Programming Discussions 4 07-21-2008 03:49 PM