Jump to content

Echo date problem


daniel28138

Recommended Posts

Can someone please tell me what I am doing wrong with this? I'm just getting "500 Internal Server Error" without an error number or explanation or anything.

 

    echo "<tr bgcolor=\"#333333\"><td><p><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\green\"><b>{$band['Name']} - Review Posted: {date("F j, Y g:i a", strtotime($band["timestamp"]))}</b></font></tr>";

 

It works without the date part. But if i put the date outside the html table, it gives the date... but I'm wanting it to display next to the "Name" like....

It would echo

Band Name - Reviewed Posted: January, 18th 2014 at 2:30pm

 

Or

Band Name
Reviewed Posted: January, 18th 2014 at 2:30pm

 

 

Many Thanks

Link to comment
https://forums.phpfreaks.com/topic/285478-echo-date-problem/
Share on other sites

I'm curious, what do you use to code in? If you used any sort of IDE, then you would see that you have a syntax error.

Using the curly braces around php functions in a string won't work, you need to concatenate the function inside the string.

 

Refer to the fixed code below

echo "<tr bgcolor=\"#333333\"><td><p><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\green\"><b>{$band['Name']} - Review Posted: ".date("F j, Y g:i a", strtotime($band["timestamp"]))."</b></font></tr>";

That should fix your problem.

 

As for there not being an error number, 500 Internal Server Error is an error number..

 

Denno

Link to comment
https://forums.phpfreaks.com/topic/285478-echo-date-problem/#findComment-1465695
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.