Hi all.
I am having a problem with is explode code but I think my problem starts wth creating the ARRAY.
I have a query that brings back data, one of the data fields is serialised so I need to use EXPLODE to break it up.
This is my attempt :
mysql_select_db($database_baggageppin, $baggageppin);
$query_sales_commision = sprintf("SELECT p.payment_id, p.product_id, p.begin_date, p.paysys_id, p.data, p. amount, p.completed, p.coupon_id, p.processed,p. retail, c.coupon_id, c.code FROM amember_baggagepayments p, amember_baggagecoupon c WHERE p.coupon_id = c.coupon_id AND p.retail = %s AND p.completed = %s AND p.paysys_id = %s AND p.coupon_id > %s AND p.amount > %s AND p.processed > %s ", GetSQLValueString($colname1_sales_commision, "text"),GetSQLValueString($colname2_sales_commision, "text"),GetSQLValueString($colname3_sales_commision, "text"),GetSQLValueString($colname4_sales_commision, "text"),GetSQLValueString($colname5_sales_commision, "text"),GetSQLValueString($colname6_sales_commision, "text"));
$sales_commision = mysql_query($query_sales_commision, $baggageppin) or die(mysql_error());
$row_sales_commision = mysql_fetch_assoc($sales_commision);
$totalRows_sales_commision = mysql_num_rows($sales_commision);
$data = $row_sales_commision['data'];
$Products = array();
foreach ($data as $value)
{
$Product = explode(';', $value);
$Products[$Product[0]] = array(
'product ID' => $Product[9],
'coupon' => $Product[13]);
}
print $Product[9];
print $Product[13];
I am trying to extract the content of the 9th and 13th row of the $data content.
Its not working but I think its my inexperience in ARRAy work. Can anybody help and explain how I should be doing this.
Many thanks