I am trying to make a looped variable variable accessible outside of the loop. Everything works, but I am having trouble with this piece of the code:
$dayVar."_count" = $dayVarCount;
The full code is below:
<?php
$day_1="sep_28";
$day_2="sep_29";
$day_3="sep_30";
$query = mysql_query("SELECT * FROM table WHERE id = '$id'");
while ($row = mysql_fetch_assoc($query))
{
for ($i = 1; $i <= 3; $i++)
{
$dayVar = "day_".$i;
$dayVarCount = $row[$$dayVar];
echo $$dayVar . ': ' . $dayVarCount . '<br>';
$dayVar."_count". = $dayVarCount;
}
}
echo "$day_3_count";
?>
$dayVar."_count". = $dayVarCount;cannot be a variable assignation.$day_1="sep_28";? is this important to what you're trying to do - I think that the answers might change if so.