Re: Processing Code created on the fly

From: Date: Sat, 30 Mar 2002 04:39:50 +0000
Subject: Re: Processing Code created on the fly
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-90745@lists.php.net to get a copy of this message
Yeah, I have played with the eval function a bit, but it didn't seem to help much. Then again, I haven't ever used the eval function before so I may not know how to properly implement it. I have read the page for eval on php.net several times as well as the very helpful examples, but whenever I use eval, it just prints out the same stuff. By same stuff I mean wether I use eval or just the variable by itself it just prints out the contents of the variable. In the web page source it looks as if the contents were merely echoed because it still has the $'s and variable names. Any other ideas or examples on how to implement eval on this? Thanks for the help, Jonathan Duncan "Jason Wong" <php-general@gremlins.com.hk> wrote in message news:php.general-90744@news.php.net... > On Saturday 30 March 2002 11:16, Jonathan Duncan wrote: > > > <? > > These variables are populated and assigned in a function: > > (This is just an example. In actuality these variables > > are populated using other means.) > > --------------------------------------------------------- > > $othervars = " $service = $sqlresult['service']; > > $m_amount = $sqlresult['m_amount']; > > $paidthru = $sqlresult['paidthru']; > > $amountdue = $sqlresult['amountdue'];"; > > > > $tabledata = " <TD>$account</TD> > > <TD>$service</TD>"; > > > > > > > > This is file that calls the above function: > > (The lines with the *s are supposed to take > > the data from the variables and then process > > them as if they were part of the code.) > > -------------------------------------------- > > while ($sqlresult = mysql_fetch_array($result)) { > > $id = $sqlresult['id']; > > $account = $sqlresult['account']; > > * $thefunction->othervars; > > $email = $sqlresult['email']; > > $terms = $sqlresult['terms']; > > $account_list .= "<TR CLASS=\"$oddoreven\"> > > <TD ALIGN=\"center\"><A > > HREF=\"editaccount.php?id=$id&edit=yes\">image</A></TD> > > * $thefunction->tabledata; > > <TD ALIGN=\"center\">\$$m_amount</TD> > > <TD><A HREF=\"somefile.php\">$paidthru</A></TD> > > <TD ALIGN=\"center\">\$$amountdue</TD> > > <TD><A HREF=\"mailto:$email\" > > $oelinkstyle>$email</A></TD> > > <TD ALIGN=\"center\">$terms</TD></TR>"; > > ?> > > You need to check out the eval() function. > > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > The real trouble with reality is that there's no background music. > */

« previous php.general (#90745) next »