$result = @mysql_query('SELECT createdTime FROM artman_article ');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
// Display the text of each rec in a paragraph
while ($row = mysql_fetch_array($result)) {
echo $row[date('Y m d',strtotime($createdTime))];
}
After some searching here, it looks like the date() and strtotime()
functions might do the trick.
See above.
But-- Apparently the syntax is incorrect (?). There are no results.
Thanks again.
No results. No errors. Ideas?
(The basic code structure is okay i.e. using different columns in Select,
the code will produce results. The above is just an excerpt from the script.)
No results. No errors. Ideas?
(The basic code structure is okay i.e. using different columns in Select,
the code will produce results. The above is just an excerpt from the script.)
Is that the complete code you have entered? If it is so, I don't see your loging into mysql. I don't need to see that, however, first login into mysql, then perform the query.
it should be like this:
@$connect=mysql_connect('host', 'user', 'pass');
if (!$connect){echo 'Login failed'.mysql_error();}
@$select = 'SELECT createdTime FROM artman_article';
@$result = mysql_query($select, $connect); /*$select is the query statement, and $connect is the connection identifier, so the mysql_query will use the correct connection.*/
if (!$result) {
die('<p>Error performing query: '. mysql_error().'</p>');
}
// Display each rec
$unixdate= mysql_fetch_array($result);
$normaldate = unixtojd($unixdate['createdTime']); /* or try $normaldate = unixtojd($unixdate[0]); in case the mysql_fetch_array has returned a number indexed array. */
echo $normaldate;
Unable to connect to the ' .
'database server at this time.');
}
// Select the database
if (!@mysql_select_db('grow')) {
exit('Unable to locate the ' .
'database at this time.
');
}
?>
Featured Article Candidates
<?php
$result = @mysql_query('SELECT createdTime FROM artman_article');
if (!$result) {
exit('
Error performing query: ' . mysql_error() . '
');
}
// Display text
$unixdate= mysql_fetch_array($result);
$normaldate = unixtojd($unixdate[0]); /* or try $normaldate = unixtojd($unixdate[0]); in case the mysql_fetch_array has returned a number indexed array. */
echo $normaldate;