Jump to content


Photo

Need help on this code


  • Please log in to reply
1 reply to this topic

#1 Zyncmaster2006

Zyncmaster2006
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 28 July 2006 - 03:28 AM

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

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 28 July 2006 - 03:42 AM

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.
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.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users