I have an array created by retrieving data from a MySQL table:
$sqlquery = "SELECT * FROM tblconsumers";
$dataresult = mysql_query($sqlquery);
while ($datarow = mysql_fetch_array($dataresult)) {
$consumers[] = $datarow;
}
mysql_free_result($dataresult);
One of the fields within the array 'transstatus' may have an abbreviated value.
EG: 'OK'
This represents the success of a payment.
I want to change it to "Payment Successful". Therefore:
foreach ($consumers as $key => $consumer) {
if ($consumer ['transstatus'] == 'OK') {
$consumer ['transstatus'] = "Payment Successful";
}
}
Can anyone explain please why the value does not change or an alternative method of achieving what I am trying to do?
Many thanks in advance.
BB