I am making a program that generates monthly report from the weekly report that is save from database. I can fetch the data from database through loop but the problem is i want to use the value from loop and assign it to a variable.
here's my code:
$mon=$_SESSION['mot'];
$query2 = mysql_query("SELECT * FROM keyper WHERE MONTH(date) = '$mon'");
while($row2 = mysql_fetch_array($query2))
{
$tar1 = $row2["target"];
$hi = $row2["high1"];
echo $tar1;
echo $hi;
}
After that query I got the result like this:
target1
high1
target2
high2
target3
high3
I want to assign the result of the loop into a variable like this
$a="target1";
etc...
How can I do that? Can someone help me?
Thanks in advance.