Jump to content

Date Problem Pls help


Sorrow

Recommended Posts

Hi here is my problem. I have a date in my database in the format (2008-11-30) and for each entry that I have in my database when it is displayed on my webpage I need to have it displayed like That (November 30 2008) I have found How to get the format of the date change

SELECT MONTHNAME(TestDate), DAYOFMONTH(TestDate), YEAR(TestDate) FROM Test 

 

But I cant figure out how to use it In this code(it has to be at the release date replacing {$row['NPReldate']}) since each entry are displayed one after the other on the same page

		<?php

include 'opendb.php';

$query  = "SELECT * FROM NowPlaying ORDER BY NPIndex DESC";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
  echo " 	<font face = 'Verdana'><table width='350' border = '0' cellspacing='5'>

<tr>
  <td width = '300' colspan = '2'><center><b>{$row['NPTitle']}</center> </td></tr><tr><br>
  <td rowspan = '5'><a href = '{$row['NPCase']}'><img src='{$row['NPCase']}' width='125' height='200' border = '0' align='top'></a></td>

<td>
<tr><td><b>Director :  </b>{$row['NPDirector']}<br></td></tr>
<tr><td><b>Writers  :  </b>{$row['NPWriters']}<br></td></tr>
<tr><td><b>Production Company :  </b>{$row['NPStudio']}<br></td></tr>
<tr><td><b>Actors   : </b>{$row['NPActors']}<br></td></tr>
<tr><td colspan = '2'><b>Release Date : </b>{$row['NPReldate']}<br></td></tr>
</td>
</tr>
<tr>
<td width ='300' colspan='2' align='justify'> Plot : ";
echo nl2br($row['NPPlot']);
echo "</td></tr><tr><td></td></tr>
</table><br><br><br></font>


";
}
mysql_close($con);

?>

 

Anyone has any Idea pls Thank you in advance

Link to comment
Share on other sites

Don't SELECT *

 

Do

SELECT columnname, columnname, etc, etc, DATE_FORMAT(NPReldate,'%M %e %Y') FROM ... etc

 

That's afaik.  * shouldn't be used unless you really are selecting all columns from the database.  And I don't know how you would SELECT * and append a format to one of the columns.

 

Everything else should be fine as is.

Link to comment
Share on other sites

Ok i got this to work but in my code

<tr><td colspan = '2'><b>Release Date : </b>{$row['NPReldate']}<br></td></tr>

 

But What do I replace {$row['NPReldate']} with because I tried {$row['NPReldate']} and  DATE_FORMAT( NPRelDate, ' %M %D %Y' ) also and it is not working

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.