Web Analytics Made Easy -
StatCounter mysql_num_rows(): supplied argument is not ... - CodingForum

Announcement

Collapse
No announcement yet.

mysql_num_rows(): supplied argument is not ...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mysql_num_rows(): supplied argument is not ...

    PHP Code:
            $result mysql_query("SELECT * FROM hockeystats_teams ORDER BY dates DESC");
            
    $count=0;
            if(
    mysql_num_rows($result))
            {
                    echo 
    "<font face=Arial size=+1>Online Applications List</font><p>";
                    echo 
    "<font face='Arial' size=2>Here is the complete list of applications currently stored in the database. To view the application just click on the persons name.</font>";
                    echo 
    "<table cellspacing=5 cellpadding=5 border=0 width='100%'>";
                    echo 
    "<tr><td><font face='Arial' size=2><b>Applicants Name</b></font></a></td><td><font face='Arial' size=2><b>Date Applied</b></font></td><td><font face='Arial' size=2><b>Application Status</b></font></td><td><font face='Arial' size=2><b>Applicants Phone</b></font></td><td><font face='Arial' size=2><b>Applicants E-mail</b></font></td></tr>";
                    
                    
                while(
    $row=mysql_fetch_array($result))
                {
                    
    $count=$count+1;
                    
    $team=$row["team"];
                    
    $gp=$row["gp"];
                    
    $wins=$row["wins"];
                    
    $losses=$row["losses"];
                    
    $ties=$row["ties"];
                    
    $goalsagainst=$row["goalsagainst"];
                    
    $goalsfor=$row["goalsfor"];
                    
    $points=$row["points"]; 
    Okay, there's my code...


    Here's the error:
    ----------------------
    Warning: mysql_num_rows(): supplied argument is not a valid
    MySQL result resource in
    ----------------------
    (without the lines), what is wrong, I looked over it and it isn't much different to my other scripts except looking for a different table.... hoping someone would notice it as I've been staring at this thing too long... thanks.

    I also searched the forum and the fixes that were proposed don't apply as I don't have the thing "$connection" that most people have.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #2
    Anyone?
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

    Comment


    • #3
      You wanna change this

      PHP Code:
      if(mysql_num_rows($result)) 
      to
      PHP Code:
      if(mysql_num_rows($result) >= 1
      mysql_num_rows will always return a value, so that's why you was getting that error. I'm assuming that's as you've got nothing in your db. So all I've done is just to make sure that it returns 1 or more rows

      Comment


      • #4
        Well I don't know what was wrong but it seems to work fine now....

        Thanks for the help...

        Contarty to what you said I did have two rows in my table so it wasn't because my table was empty.
        Dawson Irvine
        CEO - DNI Web Design
        http://www.dniwebdesign.com

        Comment

        Working...
        X