06-03-2008, 01:52 AM
|
#6 (permalink)
|
|
The Acquainted
Join Date: Apr 2008
Posts: 110
Thanks: 97
|
UPDATE...A few hours later...
OK, this is what I've come up with so far...
CODE:
PHP Code:
$query = "SELECT munit, COUNT(munit) AS mvar
FROM " . "key" . $c_testform .
" WHERE munit <> ' '
GROUP BY munit";
$result = mysql_query($query) ;
WHILE ($result_row = mysql_fetch_row($result))
{
$unit = '' ;
$unit_num = $result_row[0];
$unit = "\$munit".$unit.$result_row[0];
$count = 0 ;
$count = $result_row[1];
$myassign = "$unit = $count" ;
}
print_r($myassign."<br/>");
?>
Results:
$munit1 = 4
$munit2 = 19
$munit4 = 18
$munit5 = 5
$munit6 = 7
$munit7 = 19
$munit9 = 6
My problem is, "How can I get these assignments to be an actual part of the program; that is, to be 'real' variables with their associated 'real' values?"
Do you see what I mean? Outside of the above WHILE loop, "$munit1" has no meaning. I want the variables to go into memory so that they can be used as part of the execution of the program.
Probably not making much sense, but there you are.
Dave
|
|
|
|