Jump to content

Recommended Posts

Hi all,

 

I want to use a db table to store code so that I can use it as you would when using the include() function.

 

The code to display the caller code is

$appID = $_GET['appID'];
$sql="SELECT * FROM apps WHERE appID='$appID'";

$result=mysql_query($sql);

while ($row=mysql_fetch_array($result)) {

    $appCode=$row["appCode"];
    $apptitle=$row["apptitle"];
    echo "<b>" . $apptitle . "</b><br>";
    echo $appCode;
}

The code that is contained in the table field is some thing like

echo ' <table align="left"> 
<form action="chem.php?appID=1" method="post">[i]SOME TABLE STUFF[/i]</form> </table>'; 

$moles = $_POST["moles"]; $mass = $_POST["mass"]; $weight = $_POST["weight"]; 
if(somestuff){somemore stuff }

 

so obviously this doesn't work as when a ; is read it stops the intended use.

 

Does anyone know if there is a way around this or if it is even possible. I don't really want to go the include() route

 

Thanks in advance

 

Ian

Link to comment
https://forums.phpfreaks.com/topic/206612-using-code-as-a-field/
Share on other sites

cheers,,

 

and as for why, i just wanted to avoid having loads of files, when i could have everything in one table

 

may or may not be the best option

 

One thing to remember is that eval() slows down your script, because it triggers recompilation of entire script on each call.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.