php-general | 2001072
Date: 07/31/01
- Next message: Philip Olson: "Re: [PHP] dumb mysql_connect issue"
- Previous message: Alexander Wagner: "Re: [PHP] dumb mysql_connect issue"
- In reply to: Kyle: "[PHP] Execute mixed php code from mysql?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
the way i have solved this is to have another column of data_type.
switch ($data_type) {
case "php":
exec($data);
break;
case "html":
include($data);
break;
}
mike
on 7/31/01 3:24 PM, Kyle at nitro <email protected> wrote:
> For example I have in a database:
> ----------------------------- In database:
> <html><head><title>welcome</title></head>
> <body>
> <?
> if ($something == 'hello') {
> echo 'do somethoing';
> }?>
> ------------------------------ Also in Database:
> </body></html>
> -------------------------------
> Now how could i make it so that I have another page that has the following:
> -------- index.php ---------
> <?
> $db = mysql_connect ($dbhost,$dbuser,$dbpass);
> $query = "SELECT code FROM templates WHERE name = 'header'";
> $result = mysql_db_query($dbtabe,$query);
> $row = mysql_fetch_array ($result);
> echo $row[code];
> ?>
> Jump out and have some html content
> <?
> $db = mysql_connect ($dbhost,$dbuser,$dbpass);
> $query = "SELECT code FROM templates WHERE name = 'footer'";
> $result = mysql_db_query($dbtabe,$query);
> $row = mysql_fetch_array ($result);
> echo $row[code];
> ?>
> -------------- end page ----------
> For some reason it converts the tags on the php code as it pulls it out, i
> figure echo isn't the right function to do this and echo is converting the
> '<?' to '<?'.
>
> I tried eval(), I need a function similar to include(), but can take strings
> instead of files. If the content that was in the database and I include()'d
> it, it would have the desired effect.
>
> Thanks in advanced
>
> - Kyle
>
>
-- mike cullerton
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Philip Olson: "Re: [PHP] dumb mysql_connect issue"
- Previous message: Alexander Wagner: "Re: [PHP] dumb mysql_connect issue"
- In reply to: Kyle: "[PHP] Execute mixed php code from mysql?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

