I don't know if anybody is curious or not, but I found my own problem...
I changed the following code:

$cVar = addslashes( $qrNews[$cContentField . "Text"] );
eval( "<? " . $cVar . " ?>" );

to:

$cVar = $qrNews[$cContentField . "Text"];
eval( $cVar );

SO basically I removed the addslashes() (which I thought were necessary
since the code snippet had quotes in them) and the <? and ?> from the eval
funciton call, and it works as expected....


Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics,
ColdFusion, PHP, and mySQL
http://www.wizaerd.com
=================================

> -----Original Message-----
> From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 28, 2001 12:44 PM
> To: General PHP List
> Subject: confused about eval()
>
>
> I have searched the archives, php.net and zend.com, and cannot
> seem to come up with an answer as to why this isn't woking...
>
> I have the following code snippet stored in a database, and I'm
> trying to eval it with this line of code:
>
> $cVar = addslashes( $qrNews[$cContentField . "Text"] );
> eval( "<? " . $cVar . " ?>" );
>
> I've tried:
> eval( $cVar . " ?>" );
> eval( "?> " . $cVar  );
>
> and I cannot get the code snippet to actually evaluate... here's
> the output I actually do get:
>
> TCE's Canvas Chat (Java Applet)
> if( !( $myFile =
en( 
> \"http://wizaerd.com/cgi-sys/mchat.cgi?channel=wizaerd.com\", 
> \"r\" ))) { print( \"Cannot be opened\" ); exit; } while( !feof( 
> $myFile )) { $myLine = fgets( $myFile, 255 ); print( $myLine . \"
> \" ); } fclose( $myFile ); 
> Parse error: parse error in Unknown on line 0
> 
> the code in the database is correct cuz I can drop it into a PHP 
> page and it runs as expected...
> 
> Could somebody give me a hand with this?
> Thanx
> 
> 
> --- code as is in database -------
> if( !( $myFile = fopen( 
"http://wizaerd.com/cgi-sys/mchat.cgi?channel=wizaerd.com", "r" ))) {
        print( "Cannot be opened" );
        exit;
}

while( !feof( $myFile )) {
        $myLine = fgets( $myFile, 255 );
        print( $myLine . "<BR>" );      
}

fclose( $myFile );


Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics, 
ColdFusion, PHP, and mySQL
http://www.wizaerd.com
=================================


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to