Jump to content

Elements Mysteriously Dropping From An Array


Greywacke
 Share

Recommended Posts

function gettransactions($s) { //= supplier id, >= from and <= to dates available create constraints // ".(($numargs>0)?" WHERE ":"").join(" AND ",$arg_list)." $arr = array(); if ($s > 0) { array_push($arr,"13_prospectleadsent.bigint_SupplierID = ".$GLOBALS["s"]); } array_push($arr,"13_prospectleadsent.timestamp_Sent >= \"".$GLOBALS["f"]."\""); array_push($arr,"13_prospectleadsent.timestamp_Sent <= \"".$GLOBALS["t"]."\""); $tsql = "SELECT 10_serviceprospects.bigint_ProspectID, 13_prospectleadsent.smallint_ProspectOrdinal, 13_prospectleadsent.timestamp_Sent, 10_serviceprospects.text_LeadAttributes, 10_serviceprospects.text_Consumer, 1_regions.text_RegionDescription, 2_servicescatalogue.text_ServiceDescription FROM 13_prospectleadsent LEFT JOIN 10_serviceprospects ON (13_prospectleadsent.bigint_ProspectID = 10_serviceprospects.bigint_ProspectID) LEFT JOIN 1_regions ON (10_serviceprospects.bigint_RegionID = 1_regions.bigint_RegionID) LEFT JOIN 2_servicescatalogue ON (10_serviceprospects.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID) WHERE ".join(" AND ",$arr)." ORDER BY 13_prospectleadsent.timestamp_Sent DESC;"; $result = mysql_query_errors($tsql , $conn , __FILE__ , __LINE__ , false); if ($result) { while ($row = mysql_fetch_array($result)) { $leadid = $row["bigint_ProspectID"]; $ordinal = $row["smallint_ProspectOrdinal"]; $ret .= " <tr>\n"; $ret .= " <td><div class=\"timestamps\">" . (($leadid>0)?"#".($leadid+9001100)."-".$ordinal."<br />":"") . $row["timestamp_Sent"] . "</div></td>\n"; $ret .= " <td><div class=\"transactions\">"; $attr = preg_split("/<[^>]+>/","//",preg_replace("/[\r\n]+/","//",$row["text_LeadAttributes"]),-1,PREG_SPLIT_NO_EMPTY); $attribsarr = array(); foreach ($attr as $key => $val) { // contact name populate & supplier name in subject // make/model style // requirement & budget // 3rde & 4de soos wat dit is // $val = split(" = ",$value); $attribsarr[$key] = $val; } $consumer = split(";",$row["text_Consumer"]); $ret .= $attribsarr["products_description"].$attribsarr["vehicle_make_model"].((strlen($attribsarr["products_description"])==0)?" - ".$attribsarr["canopy_style"]:"")."<br />"; $ret .= $attribsarr["Requirement"].$attribsarr["canopy_req"]." - ".$attribsarr["Budget"].$attribsarr["budget"]."<br />"; $ret .= $consumer[0]." (".$consumer[1].", ".$consumer[2].")<br />". $row["text_RegionDescription"]." (".$consumer[3].")"; $ret .= "</div></td>\n"; unset($attribsarr); } mysql_free_result($result); } return $ret;}

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

this was repaired over all my on posts on saturday - i created a function to format the attributes as an array from a string passed as a parameter:

function formattribs($str = "") {	$str = preg_replace("/[\n\r]+/","//",$str);	$ret = preg_split("/<[^>]+>/",$str,-1,PREG_SPLIT_NO_EMPTY);	foreach ($ret as $value) {		// contact name populate & supplier name in subject		// make/model style		// requirement & budfget		// 3rde & 4de soos wat dit is		$val = split(" = ",$value);		$attribsarr[$val[0]] = $val[1];	}	return $attribsarr;}

Link to comment
Share on other sites

the attributes were being dropped from the $attribsarr array for the 3 distinct statement mailers (sent to suppliers with premium, trial and freemium status).it seems the problem was with the memory allocated to the php scripts in apache was used up / running low.

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...