Results 1 to 4 of 4

Thread: Cant find my error.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296

    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

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    What happens when you remove the @?

    $song_count = mysql_num_rows($result);

    Seriously, who supresses errors anyways?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296
    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

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You probably would have found that error sooner if you didn't ignore your errors...
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width