I am trying to replace parts of the below result set in the $data array, e.g. I want to format price with a thousand separator and to add a variable hyperlink instead of details.
The query itself works and I know how to modify the values as needed but I don't know how to replace the values in the array or better only pass the modifed values to the array.
Note: I need to do this in PHP (not in mySQL directly).
$stmt = $conn->prepare("SELECT itemId, price, details FROM offers WHERE itemId LIKE 'DE%' ORDER BY itemId");
$stmt->execute();
$resultX = $stmt->get_result();
$rowCountX = $resultX->num_rows;
$data = array();
while($rows = $resultX->fetch_assoc()) {
$data[] = $rows; // array that I want to change
}
Update:
Example:
itemId: b500 -> should be b500 // unchanged
Price: 1500 -> should be 1,500
Details: Item 123 -> Item 123
Can someone help me with this ?
Thanks, Tom