Jump to content

I can't figure out how to convert a date from the database.


vetman

Recommended Posts

It show up as this: 2009-10-03, what I want is this: 10-03-2009.

Any help would be appreciated!

Thanks

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<title></title>
<head>

<link rel="stylesheet" href="./stylesheet/stylesheet1.css" media="screen">
<style type="text/css" media="screen">@import url("./stylesheet/stylesheet2.css");</style>

</head>
<body>

<?php

// Make a MySQL Connection
include 'config.php';
//include 'style_1.php';

$con = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname) or die(mysql_error());

//echo "Connected to Database <br>";

// Retrieve all the data from the "news" table
$result = mysql_query("SELECT * FROM news") or die(mysql_error());

// store the record of the "news" table into $row
$current = '';

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
$id = $row['id'];
if (!$current) {
echo "<center><div><table border='0' width='600'>";
$current = $id;
} elseif ($current != $id){
echo "</table></div><br><br><div><table border='0' width='600'>";
$current = $id;
}
// Print out the contents of each row into a table
echo "<tr><td>{$row['postdate']}</td></tr>";
echo "<tr><td>{$row['title']}</td></tr>";
echo "<tr><td>{$row['content']}</td></tr>";

}
echo "</table></div></center>";

?>

</body>
</html>

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.