Hey there,
I'm making a database query that returns this error message
"Query was empty"
I printed out my query and it comes out like this:
SELECT date,id FROM articles WHERE 1 ORDER BY date DESC
I copied and pasted this into the SQL area of php MyAdmin and the query worked beautifully showing valid results.
So if anyone could clue me in as to why it's empty from within my code that would be awesome.
I'm not sure how the rest of my code would affect it, but here it is just in case:
function get_sorted_rows($table,$columns,$key,$condition,$direction){
if (!$direction){$direction ="DESC";}
$my_query="SELECT $columns FROM $table WHERE $condition ORDER BY $key $direction";
$results=mysql_query($column_query)or die("Invalid query: ".__LINE__. mysql_error()."<br>$my_query");
while ($my_row=mysql_fetch_row($results)){
$result[]=$my_row;
}
if (count($result)==1){
$result = $result[0];
}
return $result;
}[/COLOR]