I am trying to create a CMS and I keep getting this syntax code erro
- You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM Department ORDER BY name' at line 1
but I am using this same syntax on a different script and it runs fine????
Here is were i am getting the error:
###############################################
$table_name = "Department";
$connection = @mysql_connect ("localhost", "local", "host")
or die(mysql_error());
$sql = "SELECT dept_id, name, FROM $table_name ORDER BY name";
$result = @($sql,$connection) or die(mysql_error());
while($row = mysqli_fetch_assoc($results)) {
$options['dept_id'][$row['dept_id']] = $row['name'];
}
?>
Does anyone know why I would be getting this error on this script and not on another? I can supply the rest of the script if need be. I just don't understand and any help would be much appreciate.
Also, this is my first time using a forum, so I apologize right off the bat if i am doing something wrong.