Re: DB and eval. HELP !!!
| From: | szii at sziisoft dot com | Date: | Mon, 20 May 2002 18:11:58 +0000 |
| Subject: | Re: DB and eval. HELP !!! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19289@lists.php.net to get a copy of this message | ||
foreach($website = mysql_fetch_array($result))
{
$text = "You can go here:
<strong><?=$website['originalDomain']?></strong> and find
information";
eval($text);
}
You get the idea...
'Luck
-Szii
----- Original Message -----
From: "Bogdan ROMAN" <bogdanbog@yahoo.com>
To: <php-db@lists.php.net>
Sent: Monday, May 20, 2002 5:16 AM
Subject: [PHP-DB] DB and eval. HELP !!!
Hello
I busted my a$$ out to figure it out but i had to ask for help.
Considering you have this line in a DB (TEXT field):
You can go here: <strong><?=$website['originalDomain']?></strong> and
find information
That needs to be output in a html webpage between two <p> tags.
How can you eval the <?=$website['originalDomain']?> to the contents of
$website['originalDomain'] ?????
I've tried this:
print '<p>'.preg_replace( "'<\?=(.*?)\?>'esi",
'\\1', $row['title'] ).'</p>'
Where $row is the result from mysql_fetch_assoc() function and 'title' is the field
containing the above line. If i use the above
line of code (with preg_replace) or if i simply try to eval the code i get errors like:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
h:\wwwroot\work\site\website_gen.php(41) : regexp code on line 1
Parse error: parse error, unexpected $ in h:\wwwroot\work\site\website_gen.php(41) : regexp code on
line 1
Fatal error: Failed evaluating code: $website[\'originalDomain\'] in
h:\wwwroot\work\site\website_gen.php on line 41
As you note, it automatiaclly adds slashes to the ['originalDomain']. I tried to remove
them with stripslashes() or even again
preg_replace() but doesnt work.
Please help !!!
Thank you,
Bogdan
Bogdan Roman
email:bogdan.roman@gmx.net
msn:mastabog@hotmail.com
yahoo:bogdanbog
website:http://bog.ath.cx