Jump to content

PHP Code Within MYSQL Table Entry?


Selacius

Recommended Posts

I am creating an online RPG, which is why I've asked so many questions around here. This next question is probably my biggest and hardest one yet. I am curious how and if I can put and later execute PHP code in a table entry. This is for my quest system and instead of having billions of pages for each quest, I would rather insert the php code necessary for each quest in the database. So for example, if I have an NPC which will initiate the quest, then in the NPCs database entry I will have one column where I would put some php code, such as mysql_queries, mathematics etc. I hope this is easy to understand. Thanks.

Link to comment
Share on other sites

Yea, I thought so too. I was testing it out completely wrong. But when I inserted the actual code into the database and did a mysql_query and such, the outputted value was the actual code that I had in the table value. So I tried eval, but I got this error: Parse error: parse error, unexpected T_VARIABLE in c:\ibserver\www\test\text2.php(8) : eval()'d code on line 1This is the code which is found in the column: $result = mysql_db_query ("$dbs","SELECT * FROM enemy WHERE eid='0'"); $row = mysql_fetch_array($result); $ename = $row['ename']; $estr = $row['estr']; $emin = 1.25 * $estr; echo "$ename - $emin";

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...