Just fun question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
agriz
Forum Contributor
Posts: 106
Joined: Sun Nov 23, 2008 9:29 pm

Just fun question

Post by agriz »

Hi,

I just thought something. So i want to know whether it is possible. ( Obviously i am not going to use such a method in website. )

Can you execute PHP coding from Mysql?

Code: Select all

<?
$query = "SELECT * FROM tbl LIMIT 1";
$result = mysql_query($query);
$record = mysql_fetch_object($result);

echo stripslashes($record['somerecord']);
?>
Assume It is unchangeable :)

Now you have only option to change the database value.

stored text :

this is simple text
<p> This is simple html text </p>
<?php echo "This is simple php text"; ?>

It displays only
this is simple text
This is simple html text

Any idea... :D
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Just fun question

Post by Weirdan »

agriz
Forum Contributor
Posts: 106
Joined: Sun Nov 23, 2008 9:29 pm

Re: Just fun question

Post by agriz »

I told that we can't modify the php code. So, i think eval cant be used in database.
Post Reply