I am trying to construct a PHP script, but I can't even get the mysql_query to work. Every time I run the script below I keep getting the "Couldn't execute query" message. I can't get any further until I fix this, and I don't know what's causing it. <?php $username="username"; $password="password"; $database="database"; @mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT * FROM skt1_news ORDER BY DESC news_id LIMIT 0,3"; $result = @mysql_query($query) or die ("Couldn't execute query"); ?> PHP:
Your query (line 8) is missing a column name at ORDER BY something DESC and you might want to extend your die() message to get a hint of what went wrong (line 10) ... die("Couldn't execute query: " . mysql_error());