Search
Syndication
Sponsors

How To Use Php Code Stored In Mysql Database?

I know how pull data from the database but I have stored within the a mysql field some text data. Within that that text I have put in some php variables. The problem is that when the browser renders the data that pulled from my sql, the variable stays as $user for example rather than changing to what I needed to. Is there any way to have the server process the php code stored within the mysql database?

Related posts:

  1. How To Code A Simple Php Dynamic Dropdown Form Feild From Mysql? I been struggling with this all morning. I am tiring...
  2. How Do I Get The Radio Button For Sex To Go To A Database Using Php When using php what value would I have to set...
  3. display MySQL database rows alphabetically Learn more about display MySQL database rows alphabetically by visiting...
  4. count the number of rows ina MySQL database Learn more about count the number of rows ina MySQL...
  5. Display rows from only a certain category of a MySQL database Learn more about Display rows from only a certain category...

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: , , ,

2 Responses to “How To Use Php Code Stored In Mysql Database?”

  1. Doug V Says:

    If you mean you have stored some page code in a MySQL field; in that data, there is PHP code; and you want that data to be evaluated as PHP code, you just call eval().
    < ?php
    //your DB connection data goes here
    $rs = mysql_query("SELECT column FROM table") or die("cannot execute query");
    if(mysql_num_rows($rs) > 0) {
    $row = mysql_fetch_array($rs);
    eval($row['column']);
    }
    ?>

  2. lordgun2 Says:

    You can use json : it handles encoding/decoding variables.
    If you have a big object like $object, insert into mysql json_encode($object) and later you’ll be able to retrieve it by using $object=json_decode($data)
    where $data is the correct mysql field

Leave a Reply

Translate
Links

Tags