Hi i also have the same problem:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /home/digital/up51/libs/dblib.inc on line 356

here is the script:

**=======================================================================//
// Get Members based on their individual loans
// Files which uses this function: form_collections.php 
//========================================================================*/    


             function getMembers($loan_type_ID,$loan_accnt_ID)

             {
             global $link;
             $new_temp = "CREATE TABLE temp_collections TYPE=InnoDB SELECT * FROM upcoop.loans_outstanding WHERE loan_type_ID ='$loan_type_ID'";
             $resulta = mysql_query($new_temp,$link);

             $new_query = "SELECT * FROM temp_collections";
             $resultb = mysql_query($new_query,$link);


             while ($row = mysql_fetch_array($resultb,MYSQL_ASSOC) ){





$query = "SELECT members.members_ID, members.first_name,members.mid_name,members.last_name,
          temp_collections.loan_accnt_ID,temp_collections.monthly_amornt FROM members LEFT JOIN temp_collections ON
          members.members_ID = temp_collections.members_ID
          WHERE temp_collections.loan_type_ID = '$row[loan_type_ID]'ORDER BY last_name";




             $result = @mysql_query($query,$link);
             if (!$result)
              die ("getMembers fatal error: ".mysql_error());
              $ret = array();
              while ($row = mysql_fetch_array($result) )
                  array_push($ret,$row);
                return $ret;
                        }
}

pls help me...

Recommended Answers

All 4 Replies

Please wrap code in [ code ] tags.

Are you sure the contents of your $result variable are what you're looking for? Take a close look at your code (and maybe echo a few things out) and verify this.

The most common problem is that your query does not return anything. Also, are you sure that $link still points to the correct (and open) db?

The odd thing is that it worked in my friend's computer. this script didn't work in my computer... does it have something to do with my settings in php or mysql?

Take the warning suppression marker (@) out of this line of code:

$result = @mysql_query($query,$link);

so that you can see the error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.