Need help de-bugging a script

Looking for volunteers to join your project? Need help with a script but can't afford to pay? Want to offer your services as a volunteer to build up your portfolio? This is the place for you...

Moderator: General Moderators

Post Reply
David Crabtree
Forum Newbie
Posts: 2
Joined: Mon Aug 09, 2010 10:34 pm

Need help de-bugging a script

Post by David Crabtree »

Hi

I bought a script awhile back that was full of bugs. The script is a lead generator and sales tracker. I have been able to fix some of the bugs, but I still can't get the autoresponder to work properly. The autoresponder is suposed to kick in when a new lead comes in and the buyer has opted to buy the lead insantly and it sends it to his email AND at the same time it sends out a autoresponder to the person who filled out the form.

I have set the script up on my server in order to test it out. I need a volunteer that would like to like to help me get it to be stable. You would have to be able to work with PHP and MySQL database.

If you would like to practice your de-bugging skills, please contact me at david@reddingbusinessdirectory.com for more information, User name, and passwords to get started.

Below is an example of part of the script that needs de-bugged. It gives an error: "supplied argument is not a valid MySQL result resource"

Thanks for your help!!
David

Code: Select all

$query="SELECT AC.usid AS cuid
                                                                 , AF.usid AS afuid
                                                                , C.cost as afcost
                                                                , C.cost*AF.ratio*AC.ratio AS ccost
                                                                , CC.lpd as lpd
                                                                , CC.emailsubject
                                                                , CO.name as company
                                                                , CO.id as coid 
			    FROM account_customer AC
                                                           , customer_campaign CC
                                                           , campaign C
                                                           , account_affiliate AF
			    LEFT JOIN customer_lead CL ON CL.lid='$lid' 
                                                               AND CL.usid=AC.usid 
			    LEFT JOIN account A on A.id = AC.usid
			    LEFT JOIN company CO on A.company = CO.id
			    WHERE CC.usid=AC.usid 
                                                                     And CC.usid not IN ($cust_id) 
                                                                    AND CC.cid='$cid' AND C.id=CC.cid
			                    AND AC.pause=0            
			                    AND C.active=1 
	                                                    AND C.deleted=0 
	                                                    AND C.approved=1
	                                                    AND AF.usid=C.usid
				  AND AC.pauseuntil<'".date("Y-m-d H:i:s")."'  
	                                                  AND C.cost*AF.ratio*AC.ratio<=AC.balance  and $filter         
			    ORDER BY CO.id, AC.lastcust";
		}
		else 
		if($match==0)
		{
		$query="SELECT AC.usid AS cuid
                                                         , AF.usid AS afuid
                                                         , C.cost as afcost
                                                         , C.cost*AF.ratio*AC.ratio AS ccost
                                                         , CC.lpd as lpd
                                                         , CC.emailsubject
                                                         , CO.name as company
                                                         , CO.id as coid 
			    FROM account_customer AC
                                                          , customer_campaign CC
                                                          , campaign C
                                                          , account_affiliate AF
			    LEFT JOIN customer_lead CL ON CL.lid='$lid' 
                                                         AND CL.usid=AC.usid 
			    LEFT JOIN account A on A.id = AC.usid
			    LEFT JOIN company CO on A.company = CO.id
			    WHERE CC.usid=AC.usid 
                                                        And CC.usid not IN ($cust_id) 
                                                        AND CC.cid='$cid' AND C.id=CC.cid
			       AND AC.pause=0            
			       AND C.active=1 
	                                       AND C.deleted=0 
	                                       AND C.approved=1
	                                       AND AF.usid=C.usid
		                       AND AC.pauseuntil<'".date("Y-m-d H:i:s")."' 
	                                       AND C.cost*AF.ratio*AC.ratio<=AC.balance            
			    ORDER BY CO.id, AC.lastcust";
				}
		//}
		//echo "<br>".$query;
		//exit;

	    $rv=mysql_query($query,$dbc);
	    //$l_cost = $ar['ccost'];
	    $l_cost = $rv['afcost'];
	   
//XXXXXXXXXXXXXXXXXXXXX  THE NEXT LINE GAVE AN ERROR supplied argument is not a valid MySQL result resource

	    if (mysql_num_rows($rv)!=0) mysql_query("UPDATE lead SET sold = 0 WHERE id='$lid'",$dbc); 

	    $tcoid= "0";
//XXXXXXXXXXXXXXXXXXXXX THE NEXT LINE GIVES AN ERROR supplied argument is not a valid MySQL result resource
		 
                        for($i=0; $i<mysql_num_rows($rv); $i++)

		{
		
$ar=mysql_fetch_array($rv);
Post Reply