Jump to content

run code from the databasE? displaying as string?


AbydosGater

Recommended Posts

Hi,

I have all my menus and pages stored im my database,

And i want to be able to run code within my pages, but when i put php in the database, and run the page, its just displayed as a string, how do i get it to run the code itself??

Thanks
Well i am using the function...

<?PHP
function buildMenu($location){
$query = "SELECT * FROM agc_menus WHERE location='$location' AND active='1'";
$result = mysql_query($query);
while ($menurow = mysql_fetch_assoc($result)){
$title = $menurow['title'];
$content = $menurow['content'];

echo <<<MENUITEM
<table style="BORDER-COLLAPSE: collapse" height=37 cellspacing=0
      width=137>
                  <tbody>
                  <tr>
                    <td valign=top colspan=3
          height=18 background=images/menu_top.gif>
                      <p align=center><span style="FONT-SIZE: 7pt"><font color="#FFFFFF">$title</font></span></p>
                    </td>
                  </tr>
                  <tr>
                    <td valign=top width=9 background=images/left.gif height=96>
                      <p>&nbsp;</p>
                    </td>
                    <td valign=top width=112 height=96>
<font color="#FFFFFF">$content</font>
                    </td>
                    <td valign=top width=8 background=images/right.gif height=96>
                      <p>&nbsp;</p>
                    </td>
                  </tr>
                  <tr>
                    <td valign=top background=images/menu_bot.gif colspan=3
          height=18>
                      <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
                    </td>
                  </tr>
                  </tbody>
                </table>
<br />
MENUITEM;
}
};
?>

It pulls all the menus i have in the database, and displays them in a table on the $location, of the page, ie: left, right....

But in some of these menus i want to have like users online and things like that!
This is the only way i can think!, i was going to create a function to dosplay the users and just put the function in the database, not aload of code!

Any other ideas??

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.