Hello

This is the code:
   $m = 1;
   while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
     foreach ($line as $field => $value) {
     $tmp = $field.$m;
$$tmp.= $value;  /* ********This is the error line 117******* */
     }
     $m++;
   }

This is basically so that i can use the array via variables like so:
if($tcl2==1){echo $tcl2;}
instead of: if($arrayname['tcl']['1']==1){echo $arrayname['tcl']['1'];} and
so on....esp since i have 38 fields.

I can of course just shut off error reporting...but thats not the best
solution right? and i still wouldnt know whats causing these notices...

Simply define $$tmp -variable before adding stuff in it.


[code]
$m = 1;
while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
foreach ($line as $field => $value) {
$tmp = $field.$m;
$$tmp = "";
$$tmp .= $value; }
$m++;
}
[/code]


No it should whine about undefined vars.

Cheers, Joona
--
Joona Kulmala <[EMAIL PROTECTED]>
PHP Finland


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to