Jump to content

Need help on this code


Zyncmaster2006

Recommended Posts

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;
}
}
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.