-
Cant find my error.
PHP Code:
<?
$query = "SELECT * FROM `songs` WHERE `user` = '$user' ORDER BY `id` DESC";
$result = mysql_query($query);
$song_count = @mysql_num_rows($result);
if ($song_count == 0) {
echo "none";
} else {
while( list( $title, $artist ) = mysql_fetch_row( $result ) ){
echo "$title - $artist";
}
}
?>
Anyone see an error, I'm always getting 0 as a song_count and yes, i'm connecting tot he database and yes the database has an enrty. and yes $user variable is set.
-
What happens when you remove the @?
$song_count = mysql_num_rows($result);
Seriously, who supresses errors anyways?
-
extremly sorry, I found my error and forgot to come back and tell you. My error was....I was connecting to the wrong database. Dumb mistake. Thanks for the help though Kris.
-
You probably would have found that error sooner if you didn't ignore your errors...