Page 1 of 1

Just fun question

Posted: Thu Mar 17, 2011 5:34 am
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

Re: Just fun question

Posted: Thu Mar 17, 2011 11:19 am
by Weirdan

Re: Just fun question

Posted: Thu Mar 17, 2011 11:54 am
by agriz
I told that we can't modify the php code. So, i think eval cant be used in database.