Author Topic: Need help on this code  (Read 489 times)

0 Members and 1 Guest are viewing this topic.

Offline Zyncmaster2006Topic starter

  • Irregular
  • Posts: 8
    • View Profile
Need help on this code
« on: July 27, 2006, 11:28:33 PM »
I have a problem on this script. i think its not working...

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;
}
}

Offline redarrow

  • Freak!
  • Posts: 8,150
  • Gender: Male
  • PHP IS FOR LIFE!
    • View Profile
    • my free dating site (a blind php programmer!)
Re: Need help on this code
« Reply #1 on: July 27, 2006, 11:42:03 PM »
wheres the wheres cluse at the end of here.

$new_query = "SELECT * FROM temp_collections";

also where your
OR DIE("there is a mysql problam"); on all querys.

$resultb = mysql_query($new_query,$link);

also use mysql_fetch_assoc ok.
while ($row = mysql_fetch_array($resultb,MYSQL_ASSOC) ){

and get rid of @ if theres an error fix it.

and last of all echo out all your querys for debugging ok.
« Last Edit: July 27, 2006, 11:44:31 PM by redarrow »
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.ath.cx/paypal_info/paypal1_info.inc