Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   Outputting PHP code from MySQL (http://siteownersforums.com/showthread.php?t=50847)

ncjbhd 09-06-2011 12:14 AM

Outputting PHP code from MySQL
 
Hi All,

I am storing some PHP code in a MySQL table for inclusion on a page. My problem is that, when the page calls the content for the page, it's as if the PHP doesn't exist... nothing happens!

Being a newbie to MySQL, I have no clue why this is (or, more precisely!) isn't happening.

Can someone give me a tip??

Thanks in advance.

henryhill108 09-13-2013 10:36 AM

Actually I have knowledge of coding but for gaming apps. So not more info by me. I hope someone will help you.

therapyportal 09-14-2013 03:23 AM

Can you give us an example of the code you are using and the query?

Ranjan123 10-16-2013 08:43 AM

PHP code in mysql will not work, unless you need to re-execute in the server

alligatortek001 03-17-2014 05:23 AM

I know the bascis only.. i dono the whole funtionality

milos87popovic 03-21-2014 03:15 AM

Can you share code with us?

mikhapop 03-21-2014 05:32 AM

Sorry But What you are talking about???????
 
This is very strange, if you want to include any php code or call it, you have to create either functions or classes (Objects), you must save data types only in Mysql Database, e.g if you want to retrieve some text, read about object oriented php. (Database is to store data only not code)

mikhapop 03-21-2014 05:37 AM

if you want to store any code as data you must put it as text and then in the view you can put

example


in index.php


$query = "SELECT * FROM some_table WHERE anything = anything";
$results = mysql_query($query); ---->will get you the php code you stored as text

while ($text = mysql_fetch_array($results))
{
echo " echo $text['php'];
echo "?>";
}


the result will be
some php code here
?>

but as i said it will be represented as text not as code to run


All times are GMT -7. The time now is 07:44 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.