Hello,
when running this script:
<?php
view_users
$page_title = 'view users';
include ('templates/header.inc');
require_once ('mysql_connect.php');
$query = "SELECT CONCAT(last_name, ',' ,first_name) AS name, DATE_FORMAT (registration_date, '%M %d, %Y') AS dr FROM users ORDER BY registration_date ASC";
$result = @ ($query);
if ($result){
echo '<table align="center" cellspacing = "2" cellpadding = "2"><tr><td align = "left"><b>Name</b></td><td align = "left"><b>Date Registered</b></td></tr>';
while ($row = mysql_fetch_array($result, MYSQL_NUM)){
echo "<tr><td align = \"left\"> $row[0]</td><td align = \"left\">$row[1]</td></tr>\n";
}
echo '</table>';
// free up query resources
mysql_free_result ($result);
}else{
echo '<p> The users could not be displayed due to a system error. We apologise for any incovenience.</p><p>' . mysql_error() . '</p>';
}
mysql_close();
include ('templates/footer.inc');
?>
I always get the "syntax error" message around this '(registration_date, '%M %d, %Y') AS dr FROM users ORDER BY regi'
The thing is, I'm typing in php from a book! (Larry Ullman's "PHP and MYSQL for dynamic websites if you're interested) and I've typed it and re-typed it but I'm getting nowhere.
Can anyone help please?