|
-
Sep 26th, 2002, 07:49 PM
#1
Thread Starter
Hyperactive Member
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.
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Sep 26th, 2002, 08:43 PM
#2
Stuck in the 80s
What happens when you remove the @?
$song_count = mysql_num_rows($result);
Seriously, who supresses errors anyways?
-
Sep 26th, 2002, 08:55 PM
#3
Thread Starter
Hyperactive Member
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.
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Sep 26th, 2002, 08:59 PM
#4
Stuck in the 80s
You probably would have found that error sooner if you didn't ignore your errors...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|