[SOLVED] Problem with code

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

[SOLVED] Problem with code

Post by dakkonz »

Can anyone tell me if there is anything wrong with this statement

$query = "SELECT * FROM song ORDER BY songname ASC WHERE status='$stat'";
$result = @mysql_query ($query);

while ($row = mysql_fetch_array($result)) {
echo "{$row['songname']}";
}//end of while

i get error for $row = mysql_fetch_array($result))
Help!!!!
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

http://www.mysql.com/doc/en/SELECT.html
You need to place WHERE clause before ORDER BY clause.
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

Post by dakkonz »

gee thanks
Post Reply