I’m trying to set variables $upkeep_1, $upkeep_2, etc using a loop.
I have this code:
$sql_result2 = mysql_query("SELECT * FROM houses_db", $db);
while ($rs2 = mysql_fetch_array($sql_result2)) {
$upkeep_{$rs2[type]} = (int) $rs2[upkeep];
}
echo $upkeep_3 . "<br>";
$rs2[type] is a number field, starting at one and going up to 8.
This code outputs nothing though, despite $rs[upkeep] being 3000. What am I doing wrong?
Why not using an array?