I'm making a couple assumptions
- You have a table with columns
"payout_item_1" through "payout_item_5"
- You do not have variables called
$payout_item_1 through $payout_item_5 in which the actual column names are stored.
Currently your code is building variable variables:
This statement builds a variable name with payout_item_1 (in the first iteration). Effectively $payout_item_1.
${"payout_item_" . $x}
The code is then looking for a value in that variable to use as the column header name. Effectively, it's expecting somewhere further up for there to be something akin to
$payout_item_1 = "column1";
Which, as the error suggests, it cannot find. If my assumption in 1. was correct, all you need to do is reformat to
$row["payout_item_" . $x]
and you will be referencing the column payout_item_1 (through 5) from your $row object. Written literally:
$row["payout_item_1"]
var_dump($row)show?