I'm having problems formatting a date retrieved from mysql database. When I retrieve the date it's in the format YYYY-MM-DD. I need to split the Day, Month and Year portions of the date up so that I can represent them in a drop down menu.
I've posted my source code below, such as it is. I need a function of some kind to allow me to manipulate the $row["DOB"].
I've posted my source code below, such as it is. I need a function of some kind to allow me to manipulate the $row["DOB"].
Code:
#connect to mysql
$conn = @mysql_connect( "host", "username", "password" )
or die( "Err:Conn" );
#select specified database
$rs = @mysql_select_db( "database", $conn )
or die( "Err:Db" );
#create the query
$sql="select playerid, firstname, surname, DOB from player order by surname";
#execute the query
$rs = mysql_query( $sql,$conn );
#write the data
echo" <table width=\"270\" border=\"0\">" ;
while( $row = mysql_fetch_array( $rs ) )
{
echo" <tr> ";
echo "<td> <a href=\"editplayer.php?playerid=$row[playerid]\">".$row["surname"].", ".$row["firstname"]."</a></td>";
echo"<td>".$row["DOB"]."</td>";
echo" </tr> ";
}
echo" </table>";
Comment