I have a table for files with 3 rows: name, desc, user.
Name is the name of the file, for example: cert1.pdf Desc is a description of the file, for example: First exam of the year. User is the name of the user who uploaded the file to the server, for example: John Doe.
Now I want to retrieve the name and the description of cert1.pdf. So this is what I got:
$sql = "SELECT desc, user
FROM files AS f
WHERE f.name = 'cert1.pdf'";
$result = mysql_query($sql);
if (!$result) {
die('Error: ' . mysql_error());
}
It must be something really stupid, but I keep having this error message:
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 'desc, user FROM files AS f WHERE f.name = 'cert1.pdf'' at line 1
Any idea of what am I doing wrong here? Thanks in advance.