What's wrong with this code:

<?php

include('include/con_database.php');

$result2 = mysql_query("SELECT * FROM banner ORDER BY DESC");

while ($data2 = mysql_fetch_array($result2)){

echo '<td>'.$data2['images'].'</td>'.'<br>';

}

?>

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\xampp\xampp\htdocs\IndonusaCMS\index.php on line 39

Line 39:  while ($data2 = mysql_fetch_array($result2)){

Recommended Answers

All 4 Replies

Your ORDER BY is missing a column name.

The reason you getting this error is that the mysql_fetch_array function expects a resource but is being passed a boolean. What you should know is that the mysql_query function will always return a boolean if there is an error in your query.
The error in your query has been pointed out by pritaeas.

Hi

Order by column_name is missing. check the syntax for reference

SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.