Texan78 Posted June 20, 2013 Share Posted June 20, 2013 Hello all, I am having trouble doing something I am familiar with and do all the time but for some reason it is not working in this instance. I have tried many different combinations to echo the date in a table cell. The problem is NOT with the php for the date as I am familiar with date formating. Problem I am having is it is not showing up when I echo and it gives me a parsing error. I have tried it many different ways. With and without double quotes, with and without single quotes, without quotes all together. without single quotes before and after like it is now. Whatever I try it just doesn't want to echo the date. I am not sure what I am missing. Maybe I just need an extra set up eyes. I know this is a really simple issue I am just having a brain fart. This is the actual line. <td style="font-size: 100%;"><b>Weather History for' echo date("D M jS"); '</b></td> This is a snippet from where the code is from. // FULL HISTORY TABLE $fullHistory = ' <!-- Start Weather History --> <div class="NWSround"> <table width="640px" text-align="center" cellpadding="0" cellspacing="0" style="margin:4px 11px 0px 11px;"> <tr> <td style="font-size: 100%;"><b>Weather History for' echo date("D M jS"); '</b></td> </tr> <tr> <td> </td> </tr>'; $yearCount = count($historicalData); // count keys in the array for ($i = 0; $i < $yearCount; $i++){ // for each key, print the date and description $fullHistory .= " <tr>\n"; $fullHistory .= " <td style=\"text-align:justify; font-size: 12px;\">\n"; $fullHistory .= $historicalData[$i]."<br /><br />\n"; $fullHistory .= " </td>\n"; $fullHistory .= " </tr>\n"; } $fullHistory .= ' <tr> <td> <span style="font-size: 9px;">'.$credited.'</span> </td> </tr> </table> </div> <table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><img alt="" src="images/1pixel.gif" border="0" height="7" width="7"></td><td class="shadow-mid" width="100%"><img alt="" src="images/1pixel.gif" border="0" height="7" width="7"></td><td><img alt="" src="images/1pixel.gif" border="0" height="7" width="7"></td></tr></tbody></table> '.$notes.'<!-- End Weather History --> '; Quote Link to comment https://forums.phpfreaks.com/topic/279375-i-unable-to-echo-date-in-html-table/ Share on other sites More sharing options...
Solution PravinS Posted June 20, 2013 Solution Share Posted June 20, 2013 <td style="font-size: 100%;"><b>Weather History for' echo date("D M jS"); '</b></td> above line should be like this <td style="font-size: 100%;"><b>Weather History for '.date("D M jS").'</b></td> Quote Link to comment https://forums.phpfreaks.com/topic/279375-i-unable-to-echo-date-in-html-table/#findComment-1436981 Share on other sites More sharing options...
Texan78 Posted June 20, 2013 Author Share Posted June 20, 2013 Ah yeah thanks! I tried that previously but after looking at it when you did it I forgot to remove the ; from the end when I did it when that wasn't actually the end of the code and should have been removed. DOAH! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/279375-i-unable-to-echo-date-in-html-table/#findComment-1436984 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.