manalnor Posted February 12, 2011 Share Posted February 12, 2011 Hello dear friends, i've made database table if(isset($_POST[s1])) { $qeg = "update my_table set code = '$_POST[code]' "; $reg = mysql_query($qeg) or die(mysql_error()); echo 'done'; } and get the stored text in my table $qeg = "select * from my_table"; $reg = mysql_query($qeg) or die(mysql_error()); $aeg = mysql_fetch_array($reg); and an form for it to post text <form method=post> code : <textarea id="code" name="code"><?=$aeg[code]?></textarea> <input type=submit name="s1" value="Add"> </form> now when i post example : <?php date("Y-m-d"); ?> it should be stored but when i call it in an php file , it not appear <?php $qeg = "select * from my_table"; $reg = mysql_query($qeg) or die(mysql_error()); $aeg = mysql_fetch_array($reg); ?> <?=$aeg[code]?> why !!! can't store php code into mysql table sorry for bad english , i mean db table <--- store in it an php code when i call it back it doesn't apprears when i view page source it appears but not active as if plain text as in the pink colored text can be seen in source but not active thank you Link to comment https://forums.phpfreaks.com/topic/227482-php-in-table/ Share on other sites More sharing options...
Pikachu2000 Posted February 12, 2011 Share Posted February 12, 2011 When you store it in the database, it isn't php code anymore. It becomes a plain string, and is echoed like any other string. Why would you want to do that anyhow? Link to comment https://forums.phpfreaks.com/topic/227482-php-in-table/#findComment-1173375 Share on other sites More sharing options...
dornizar Posted February 12, 2011 Share Posted February 12, 2011 if you want to run a php script from a plain string you sould use the Eval() Function: for further info - http://www.php.net/manual/en/function.eval.php Link to comment https://forums.phpfreaks.com/topic/227482-php-in-table/#findComment-1173384 Share on other sites More sharing options...
manalnor Posted February 12, 2011 Author Share Posted February 12, 2011 @Pikachu2000 thank you for the informations @dornizar i've tired and thank alot , works fine Link to comment https://forums.phpfreaks.com/topic/227482-php-in-table/#findComment-1173389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.