Undefined variable problem

From: Date: Fri, 01 Aug 2003 13:46:23 +0000
Subject: Undefined variable problem
Groups: php.general 
Request: Send a blank email to php-general+get-157932@lists.php.net to get a copy of this message
Hi, This is the following code given to me by Jenniffer Goodie (thank you) which is working great but is throwing this notice: Notice: Undefined variable: email1 in c:\phpdev\www\bwh\project\compare.php on line 117 Notice: Undefined variable: address1 in c:\phpdev\www\bwh\project\compare.php on line 117 Notice: Undefined variable: city1 in c:\phpdev\www\bwh\project\compare.php on line 117 etc (30+ notices) 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... Any ideas? Cheers, -Ryan We will slaughter you all! - The Iraqi (Dis)information ministers site http://MrSahaf.com

« previous php.general (#157932) next »