Reputation: 27
I'm receiving this syntax error
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'
from this code
$insert_status=mysql_query("INSERT INTO status(status, date) VALUES
('$status','$date')") or die (mysql_error());
$get_status= mysql_query("SELECT * FROM status WHERE id DESC")
or die (mysql_error());
while($row=mysql_fetch_array($get_status)){
$status=$row['status'];
$date=$row['date'];
}
Mysql version is 5.0.91-community
How can I resolve this small issue? Thanks in advance
Upvotes: 0
Views: 193
Reputation: 7614
WHERE id [...] DESC <- you need something in your where-clause AND you need to clarify what you're ordering on. Something like:
select * from status where id in (1,2,3,4) order by id desc;
Upvotes: 2