Jump to content

values not being retrieved from the database


Greywacke
 Share

Recommended Posts

hi there,i am struggling slightly to figure out why the following function in the global include will not return some of the variables defined in the cronjob.these include functions have not changed.

function idflags($input) {	foreach ($input as $in) {		// use to explode by first space if found, to get flag values		$in = preg_split("/ /",$in,2,PREG_SPLIT_NO_EMPTY);		// print result array		// print_r($in);		// build and return the values to replace with		switch ($in[0]) {			// mail configurable flags			case "LOGO":				if ($GLOBALS["attribsarr"]["products_description"] || $GLOBALS["limit"]) {					return "%CONFIGTEXT File | Logo | CanopyXchange%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"] && $GLOBALS["response"]) {					return "%CONFIGTEXT File | Logo | QuoteMe | Canopies%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT File | Logo | CanopyXchange%";				}				break;			case "CRONLRSUBJECT":				if ($GLOBALS["limit"]=="UPPER") {					return "%CONFIGTEXT Cron | Supplier | Notification | Header | Very Low%";				} elseif ($GLOBALS["limit"]=="LOWER") {					return "%CONFIGTEXT Cron | Supplier | Notification | Header | Low%";				}				break;			case "CRONSTATESUBJECT":				if ($GLOBALS["limit"]=="MONTHLY") {					return "%CONFIGTEXT Cron | Supplier | Statement | Header | Monthly%";				} elseif ($GLOBALS["limit"]=="WEEKLY") {					return "%CONFIGTEXT Cron | Supplier | Statement | Header | Weekly%";				} elseif ($GLOBALS["limit"]=="MANUAL") {					return "%CONFIGTEXT Cron | Supplier | Statement | Header | Monthly%";				}				break;			case "CRONSTATEMESSAGE":				if ($GLOBALS["limit"]=="MONTHLY") {					return "%CONFIGTEXT Cron | Supplier | Statement | Message | Monthly%";				} elseif ($GLOBALS["limit"]=="WEEKLY") {					return "%CONFIGTEXT Cron | Supplier | Statement | Message | Weekly%";				} elseif ($GLOBALS["limit"]=="MANUAL") {					return "%CONFIGTEXT Cron | Supplier | Statement | Message | Monthly%";				}				break;			case "TRANSACTIONS":				return $GLOBALS["transactions"];				break;			case "LIMITMESSAGE":				if ($GLOBALS["limit"]=="UPPER") {					return "%CONFIGTEXT Cron | Supplier | Notification | Message | Low%";				} elseif ($GLOBALS["limit"]=="LOWER") {					return "%CONFIGTEXT Cron | Supplier | Notification | Message | Very Low%";				}				break;			case "RESPONSESIGNATURE":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Consumer | Message | Signature (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Consumer | Message | Signature (QM)%";				}				break;			case "PREMIUMSUBJECT":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Supplier | Premium | Header (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Supplier | Premium | Header (QM)%";				}				break;			case "PREMIUMINTRO":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Supplier | Premium | Message | Intro (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Supplier | Premium | Message | Intro (QM)%";				}				break;			case "PREMIUMSIGNATURE":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Supplier | Premium | Message | Signature (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Supplier | Premium | Message | Signature (QM)%";				}				break;			case "FREEMIUMSUBJECT":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Supplier | Freemium | Header (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Supplier | Freemium | Header (QM)%";				}				break;			case "FREEMIUMINTRO":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Supplier | Freemium | Message | Intro (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Supplier | Freemium | Message | Intro (QM)%";				}				break;			case "FREEMIUMSIGNATURE":				if ($GLOBALS["attribsarr"]["products_description"]) {					return "%CONFIGTEXT Email | Supplier | Freemium | Message | Signature (CX)%";				} elseif ($GLOBALS["attribsarr"]["vehicle_make_model"]) {					return "%CONFIGTEXT Email | Supplier | Freemium | Message | Signature (QM)%";				}				break;			case "RESPONSEMESSAGES":				$msg = ((join("",$GLOBALS["suppliers"]))?"	%CONFIGTEXT Email | Consumer | Message | Intro Premium%":"").					((join("",$GLOBALS["supplierp"]))?"	%CONFIGTEXT Email | Consumer | Message | Intro Freemium%":"");				return $msg;				break;			// attribute flags			case "ATTRIBUTE":				return $GLOBALS["attribsarr"][$in[1]];				break;			// consumer flags			case "CONSUMERNAME":				return $GLOBALS["consumerfullname"];				break;			case "CONSUMEREMAIL":				return $GLOBALS["consumeremail"];				break;			case "CONSUMERCELL":				return $GLOBALS["consumercell"];			case "CONSUMERCITY":				return $GLOBALS["city_town"];				break;			case "MESSAGE":				return $GLOBALS["message"];				break;			// supplier flags			case "SUPPLIERNAME":				return $GLOBALS["recipient"][1];				break;			case "CONTACTFNAME":				$fname = explode(" ",$GLOBALS["recipient"][0]);				return $fname[0];			case "CONTACTNAME":				return $GLOBALS["recipient"][0];				break;			case "ACCMGR":				return $GLOBALS["recipient"][11];				break;			case "ACCMGRMAIL":				return $GLOBALS["recipient"][12];				break;			case "PAYGBALANCE":				if ($GLOBALS["leadid"]) {					return $GLOBALS["newbalance"];				} else {					return $GLOBALS["balance"];				}			case "INVOICEAMOUNT":				return $GLOBALS["recipient"][13];				break;			// lead flags			case "LEADREFERENCE":				if ($GLOBALS["prospecting"]) {					return ($GLOBALS["leadid"] + 9001100)."-".append0($GLOBALS["ordinal"],2);				} else {					return ($GLOBALS["leadid"] + 11001000);				}				break;			case "LEADCATEGORY":				return $GLOBALS["cat"];				break;			case "PAYGCOST":				return $GLOBALS["servicecost"];				break;			case "DUPLICATES":				return $GLOBALS["append"];				break;			// other flags			case "PROSPECTMESSAGE":				return $GLOBALS["pmsg"];				break;			case "SUPPLIERLIST":				return join("",$GLOBALS["suppliers"]);				break;			case "PROSPECTLIST":				return join("",$GLOBALS["supplierp"]);				break;			case "SERVICENAME":				return $GLOBALS["servicename"];				break;			case "REGIONNAME":				return $GLOBALS["regionname"];				break;			// cronjob flags			case "FROMDATE":				return $GLOBALS["f"];				break;			case "TODATE":				return $GLOBALS["t"];				break;			// configurable text flags			case "CONFIGTEXT":				$tsql = "SELECT * FROM 18_configurabletexts WHERE 18_configurabletexts.text_TextDescription = \"".$in[1]."\" AND 18_configurabletexts.bigint_ServiceID = ".$GLOBALS["service"].";";				$result = mysql_query_errors($tsql, $conn, __FILE__, __LINE__, false);				if ($result) {					if ($row = mysql_fetch_array($result)) {						return $row["text_TextFullContent"];					}				}		}	}}function populateflags($str) {	// replace flags used in string (parse entire template contents' as string), populating flags individually and sometimes recursively in callback function.	while (preg_match_all("/%([A-Z ]+[^%]*)%/",$str,$arr)) {		$str = preg_replace_callback("/%([A-Z ]+[^%]*)%/",idflags,$str);	}	return $str;}

this code has been updatedan example of a configurable text would be %CONFIGTEXT Cron | Supplier | Transaction Detail% the fulltext being equals to %LEADREFERENCE% | %CONSUMERNAME% | %CONSUMERCELL% | %CONSUMERCITY%%ATTRIBUTE vehicle_make_model% %ATTRIBUTE products_description% - %ATTRIBUTE year_model%%ATTRIBUTE Bakkie model% | %ATTRIBUTE canopy_req%%ATTRIBUTE Requirement% | %ATTRIBUTE canopy_style%%ATTRIBUTE Colour code%. these attribute and client and lead vales do not poppulate, despite them being defined on page level before calling the populateflags function.i know the function runs, only the variables defined within the gettransactions function are not called by the populateflags function. eg LEADREFERENCE and ATTRIBUTES values. printing the values from the page where they are built before calling populateflags, shows the variables and their values. but inside populateflags where it is called they do not populate.i am slightly debilitated mentally atm due to kidney problems, but some help here would be appreciated. ask away if you are not too clear on any subject.

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

ok i've managed to get an error raised:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/dwtphovu/public_html/intellisource.co.za/prod_8347379386/private/cronjob_weekly.php on line 30
this brings me to these lines - but i am afraid i cannot see the forest for the trees:
			$sql1 = "SELECT * FROM 6_serviceleads LEFT JOIN (5_suppliers,2_servicescatalogue,1_regions) ON (6_serviceleads.bigint_SupplierID = 5_suppliers.bigint_SupplierID AND 6_serviceleads.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID AND 6_serviceleads.bigint_RegionID = 1_regions.bigint_RegionID) WHERE bigint_LeadID = ".$leadid.";";			$result1 = mysql_query_errors($sql1 , $conn , __FILE__ , __LINE__  , false);

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

this post is no longer of consequence

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

ah i noted that the $f and $t are not defined anymore, also $now to get the offsets from - and that the variables needed to be defined as $GLOBAL's from within the gettransactions function. only problem now, is that the lead information is not unique in the mails. why would this be? it is supposed to set the values for each transaction.here is the updated code of the cronjob:

<?PHP/*CANOPYXCHANGE BRANDED WEEKLY STATEMENTSVersion 2.2.4*/include("/home/dwtphovu/public_html/intellisource.co.za/prod_8347379386/includes/content/dwtphovu_f3rr37y.php");include("/home/dwtphovu/public_html/intellisource.co.za/prod_8347379386/includes/mailer/class.phpmailer.php");	// include PHPMailer classinclude('/home/dwtphovu/public_html/intellisource.co.za/prod_8347379386/includes/statistical/timezones/class-timezone-conversion.php');   /** Include timezone conversion class */function convert_tz($timestamp, $timezone) {	/** convert local datetime to SAST (South African Standard Time) */	$tz = new TimezoneConversion();				/** Create TimezoneConversion Object */	$tz->setProperty('DateTime', $timestamp);	/** Set local 'DateTime' to convert */	$tz->setProperty('Timezone', $timezone);	/** Set Timezone Convert To */	return $tz->convertDateTime();				/** Get SAST Timestamp */}function gettransactions($s) {	$ret = "";	$sql = "SELECT * FROM 8_transactions WHERE bigint_SupplierID = ".$s." AND timestamp_TransactionEvent >= \"".$GLOBALS["f"]."\" AND timestamp_TransactionEvent <= \"".$GLOBALS["t"]."\" ORDER BY bigint_TransactionID ASC;";	$result = mysql_query_errors($sql , $conn , __FILE__ , __LINE__ );	while ($row = mysql_fetch_array($result)) {		$ret .= "	<tr>\n";		$ret .= "		<td><div class=\"timestamps\">" . $row["timestamp_TransactionEvent"] . "</div></td>\n";		$ret .= "		<td><div class=\"transactions\">";		if ($row["bigint_LeadID"] > 0) {			$sql1 = "SELECT * FROM 6_serviceleads JOIN (5_suppliers,2_servicescatalogue,1_regions) ON (6_serviceleads.bigint_SupplierID = 5_suppliers.bigint_SupplierID AND 6_serviceleads.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID AND 6_serviceleads.bigint_RegionID = 1_regions.bigint_RegionID) WHERE bigint_LeadID = ".$row["bigint_LeadID"].";";			$result1 = mysql_query_errors($sql1 , $conn , __FILE__ , __LINE__  , false);			if ($row1 = mysql_fetch_array($result1)) {				$GLOBALS["leadid"] = 0;				$GLOBALS["consumerfullname"] = "";				$GLOBALS["consumeremail"] = "";				$GLOBALS["consumercell"] = "";				$GLOBALS["city_town"] = "";				$GLOBALS["regionname"] = "";				$GLOBALS["attribsarr"] = array();				$GLOBALS["leadid"] = $row["bigint_LeadID"];				$consumer = explode(";",$row1["text_Consumer"]);				$GLOBALS["consumerfullname"] = $consumer[0];				$GLOBALS["consumeremail"] = $consumer[1];				$GLOBALS["consumercell"] = $consumer[2];				$GLOBALS["city_town"] = $consumer[3];				$GLOBALS["regionname"] = $row1["text_RegionDescription"];				$attr = preg_split('/<[^>]+>/', $row1["text_LeadAttributes"], -1, PREG_SPLIT_NO_EMPTY);				foreach ($attr as $value) {					$val = explode(" = ",$value);					$GLOBALS["attribsarr"][$val[0]] = $val[1];				}				$ret1 = "%CONFIGTEXT Cron | Supplier | Transaction Detail%";				populateflags($ret1);				$ret .= $ret1;			}		} else {				$ret .= $row["text_TransactionEvent"];		}		$ret .= "</div></td>\n";		$ret .= "		<td><div class=\"balances\">" . $row["bigint_TransactionBalance"] . "</div></td>\n";		$ret .= "		<td><div class=\"amounts\">" . $row["bigint_TransactionAmount"] . "</div></td>\n";		$ret .= "	</tr>\n";	}	return $ret;}$now = getdate(strtotime(convert_tz(date("Y-m-d H:i:s", time()),"SAST")));$f = date("Y-m-d 00:00:00",mktime(0,0,0,$now["mon"],$now["mday"] - 7,$now["year"]));$t = date("Y-m-d 23:59:59",mktime(23,59,59,$now["mon"],$now["mday"] - 1,$now["year"]));$limit = "WEEKLY";$service = 1;// select supplier contact names and email addresses$sql = "SELECT 4_servicesuppliers.bigint_ServiceID, 5_suppliers.bigint_SupplierID, CONCAT(5_suppliers.text_ContactFirstName, \" \", 5_suppliers.text_ContactSurname) AS text_ContactFullName, 5_suppliers.`text_ContactE-mail`, 5_suppliers.text_AccMgr, 5_suppliers.`text_AccMgrE-mail` FROM 5_suppliers LEFT JOIN 4_servicesuppliers ON (5_suppliers.bigint_SupplierID = 4_servicesuppliers.bigint_SupplierID) WHERE 4_servicesuppliers.bigint_ServiceID = 1 AND smallint_SupplierStatus = 0 GROUP BY 5_suppliers.bigint_SupplierID;";$result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , false);if ($result) {	while ($row = mysql_fetch_array($result)) {		$toname = $row["text_ContactFullName"];		$recipient[0] = $toname;		$toaddr = $row["text_ContactE-mail"];		// build mail and attempt sending, saving response		$body			 	= getFile("/home/dwtphovu/public_html/intellisource.co.za/prod_8347379386/templat/statement.html");	// load mail template		$mail				= new PHPMailer();														// create a new object		$transactions		= gettransactions($row["bigint_SupplierID"]);							// build transactions html		$body				= populateflags($body);		/*$body				= str_replace("%MESSAGE%",$message,$body);								// insert statement message		$body				= str_replace("%TRANSACTIONS%",$transactions,$body);					// insert transaction records		$body				= str_replace("%FROMDATE%",date("jS F Y, H:i:s",strtotime($f)),$body);	// insert from date		$body				= str_replace("%TODATE%",date("tS F Y, H:i:s",strtotime($t)),$body);	// insert to date		$body				= str_replace("%LOGOURL%",$logourl,$body);								// insert logo url		$body 				= str_replace("%COPYRIGHT%","CanopyXchange",$body);						// insert copyright owner		$body 				= str_replace("%YEAR%",date("Y"),$body);								// insert copyright year*/		require("/home/dwtphovu/public_html/intellisource.co.za/prod_8347379386/includes/mailer/dwtphovu_auth.php");			// include mailer auth		$mail->From			= "canopy@canopyxchange.za.net";										// set from email		$mail->FromName		= "CanopyXchange";														// set from name		$mail->Subject		= getSubText($body,"<title>","</title>");								// replacing to and from dates		$mail->AddBCC("pierre@greywacke.co.za", "Pierre \"Greywacke\" du Toit");					// add the developer to the BCC list		$mail->AddBCC($row["text_AccMgrE-mail"], $row["text_AccMgr"]);								// add the account manager to the BCC list		$mail->ClearAttachments();																	// clears attachments		$mail->MsgHTML($body);																		// set HTML Body		$mail->AltBody = strip_tags(html_entity_decode(getSubText($body,"<body>","</body>")));		// set Text Body		//$mail->AddAddress($toaddr, $toname);														// add recipient		$mail->IsHTML(true);																		// set send as HTML		if(!$mail->Send()) {																		// if attempt sending failed				$response = "FAILURE: ".$toname.", ".$toaddr." (".$mail->ErrorInfo.")";					// save error report		} else {																					// else			$response = "SUCCESS: ".$toname.", ".$toaddr;											// save success report		}																							// end if	}}//echo mysql_real_escape_string((is_array($sql))?join("<br />\n",$sql):"");mysql_close($conn);?>

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

ps: there are two cronjobs, one for weekly and one for monthly. the $f and $t are the only differentiating dates.here is also an example of the weekly cronjob mails being sent (it is in a tabular format though, unfortunately not supported by the forum):

LEAD TRANSACTION STATEMENTCustomer:Period: 2010-10-04 00:00:00 to 2010-10-10 23:59:59Please contact , your dedicated Client Success Manager if you have any queries.TIMESTAMPTRANSACTIONBALANCEAMOUNT2010-10-04 14:44:1511006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)280152010-10-05 10:55:3011006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)265152010-10-05 15:24:4711006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)245202010-10-06 21:38:4511006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)225202010-10-07 09:47:2811006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)215102010-10-08 12:41:5911006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)200152010-10-08 18:33:1211006406 | Morgan Naidoo | 0846025902 | Cape TownFord - DCAB Kia K2700 Canopy - Half Door - 2003Latest model | pre-owned_colour_codedPre-owned - White | lowline_luxuryWhite Non-coded (standard)18515To your success!Client Success ManagerCanopyXchange TeamCopyright © 2010 CanopyXchange. All rights reserved.
MY MOST SINCERE APOLOGIES FOR THE EXTENSIVE POSTS. Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

okay the transaction text only is what it does not update for every record.why do the $GLOBALS variables not get updated with the outerloop loop of the recordset? the emails only repeat the first record's transaction information.ps: please - my focus and clarity should return with the ingrown & calcified stents being removed from my left renal ureter as soon as i am healed from the pcnl operation on the 12th october 2010. any help, even if just a nudge in the right direction asap would be extremely appreciated.

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

but why are the first values being inserted every time the populateflags function is called? even in the second and rest of the loops? making the values "empty" did not do a thing.and unsetting them as follows before setting them, doesn't seem to do a thing either.

function gettransactions($s) {	$ret = "";	$sql = "SELECT * FROM 8_transactions WHERE bigint_SupplierID = ".$s." AND timestamp_TransactionEvent >= \"".$GLOBALS["f"]."\" AND timestamp_TransactionEvent <= \"".$GLOBALS["t"]."\" ORDER BY bigint_TransactionID ASC;";	$result = mysql_query_errors($sql , $conn , __FILE__ , __LINE__ );	while ($row = mysql_fetch_array($result)) {		$ret .= "	<tr>\n";		$ret .= "		<td><div class=\"timestamps\">" . $row["timestamp_TransactionEvent"] . "</div></td>\n";		$ret .= "		<td><div class=\"transactions\">";		if ($row["bigint_LeadID"] > 0) {			$sql1 = "SELECT * FROM 6_serviceleads JOIN (5_suppliers,2_servicescatalogue,1_regions) ON (6_serviceleads.bigint_SupplierID = 5_suppliers.bigint_SupplierID AND 6_serviceleads.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID AND 6_serviceleads.bigint_RegionID = 1_regions.bigint_RegionID) WHERE bigint_LeadID = ".$row["bigint_LeadID"].";";			$result1 = mysql_query_errors($sql1 , $conn , __FILE__ , __LINE__  , false);			if ($row1 = mysql_fetch_array($result1)) {				unset($GLOBALS["leadid"]);				unset($GLOBALS["consumerfullname"]);				unset($GLOBALS["consumeremail"]);				unset($GLOBALS["consumercell"]);				unset($GLOBALS["city_town"]);				unset($GLOBALS["regionname"]);				unset($GLOBALS["attribsarr"]);				unset($consumer);				unset($attr);				$consumer = explode(";",$row1["text_Consumer"]);				$GLOBALS["leadid"] = $row["bigint_LeadID"];				$GLOBALS["consumerfullname"] = $consumer[0];				$GLOBALS["consumeremail"] = $consumer[1];				$GLOBALS["consumercell"] = $consumer[2];				$GLOBALS["city_town"] = $consumer[3];				$GLOBALS["regionname"] = $row1["text_RegionDescription"];				$attr = preg_split('/<[^>]+>/', $row1["text_LeadAttributes"], -1, PREG_SPLIT_NO_EMPTY);				foreach ($attr as $value) {					$val = explode(" = ",$value);					$GLOBALS["attribsarr"][$val[0]] = $val[1];				}				$ret1 = "%CONFIGTEXT Cron | Supplier | Transaction Detail%";				populateflags($ret1);				$ret .= $ret1;			}		} else {				$ret .= $row["text_TransactionEvent"];		}		$ret .= "</div></td>\n";		$ret .= "		<td><div class=\"balances\">" . $row["bigint_TransactionBalance"] . "</div></td>\n";		$ret .= "		<td><div class=\"amounts\">" . $row["bigint_TransactionAmount"] . "</div></td>\n";		$ret .= "	</tr>\n";	}	return $ret;}

maybe free $result1 too?

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

unfortunately freeing the inner result had no effect as follows:

function gettransactions($s) {	$ret = "";	$sql = "SELECT * FROM 8_transactions WHERE bigint_SupplierID = ".$s." AND timestamp_TransactionEvent >= \"".$GLOBALS["f"]."\" AND timestamp_TransactionEvent <= \"".$GLOBALS["t"]."\" ORDER BY bigint_TransactionID ASC;";	$result = mysql_query_errors($sql , $conn , __FILE__ , __LINE__ );	while ($row = mysql_fetch_array($result)) {		$ret .= "	<tr>\n";		$ret .= "		<td><div class=\"timestamps\">" . $row["timestamp_TransactionEvent"] . "</div></td>\n";		$ret .= "		<td><div class=\"transactions\">";		if ($row["bigint_LeadID"] > 0) {			$sql1 = "SELECT * FROM 6_serviceleads JOIN (5_suppliers,2_servicescatalogue,1_regions) ON (6_serviceleads.bigint_SupplierID = 5_suppliers.bigint_SupplierID AND 6_serviceleads.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID AND 6_serviceleads.bigint_RegionID = 1_regions.bigint_RegionID) WHERE bigint_LeadID = ".$row["bigint_LeadID"].";";			$result1 = mysql_query_errors($sql1 , $conn , __FILE__ , __LINE__  , false);			if ($result1) {				if ($row1 = mysql_fetch_array($result1)) {					unset($GLOBALS["leadid"]);					unset($GLOBALS["consumerfullname"]);					unset($GLOBALS["consumeremail"]);					unset($GLOBALS["consumercell"]);					unset($GLOBALS["city_town"]);					unset($GLOBALS["regionname"]);					unset($GLOBALS["attribsarr"]);					unset($consumer);					unset($attr);					$consumer = explode(";",$row1["text_Consumer"]);					$GLOBALS["leadid"] = $row["bigint_LeadID"];					$GLOBALS["consumerfullname"] = $consumer[0];					$GLOBALS["consumeremail"] = $consumer[1];					$GLOBALS["consumercell"] = $consumer[2];					$GLOBALS["city_town"] = $consumer[3];					$GLOBALS["regionname"] = $row1["text_RegionDescription"];					$attr = preg_split('/<[^>]+>/', $row1["text_LeadAttributes"], -1, PREG_SPLIT_NO_EMPTY);					foreach ($attr as $value) {						$val = explode(" = ",$value);						$GLOBALS["attribsarr"][$val[0]] = $val[1];					}					$ret1 = "%CONFIGTEXT Cron | Supplier | Transaction Detail%";					populateflags($ret1);					$ret .= $ret1;				}				mysql_free_result($result1);			}		} else {				$ret .= $row["text_TransactionEvent"];		}		$ret .= "</div></td>\n";		$ret .= "		<td><div class=\"balances\">" . $row["bigint_TransactionBalance"] . "</div></td>\n";		$ret .= "		<td><div class=\"amounts\">" . $row["bigint_TransactionAmount"] . "</div></td>\n";		$ret .= "	</tr>\n";	}	return $ret;}

the $GLOBALS variables need to be changed with each $result1 for each transaction because this is the only way i can see to pass values to the global populateflags function in the database include. how would i get this right?anyways - thanks for the help that was provided, and see you all in a week or two when i get outta hospital.

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

well unfortunately this cannot be, notice that the timestamps differ. that is in the outer recordset. i have done the queries manually via PMA, and it selects as i expect them to.ps: my surgery has been postponed to admission on the 19th October, due to lack of support staff in the theatre.latest idea for a solution: why don't i combine the inner and outer select statements?unfortunately this is a bit hectic for me in my current mental incapacitation due to the dehydration problems so i would likely do this when i return from the hospital, along with some other things that are way above my head & too complicated for me to work on atm. unless of course, someone can help me with combining the select statements before the 19th.well temporarily reset the function to not use configurable texts, but rather "static" predefined values from the database. same recordsets, and it works. will resolve the configurable texts within a function once i got my focus and clarity on a constant level again.

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...