I guess you could store it as a blob or text making sure that you use addslashes() before you stick it in......then use stripslashes() when you pull it out.
Then do your database query and go:
$sql = mysql_query("SELECT blah blah");
while(blah blah($sql))
{
include ("$php_doc");
}
rgds,
scott d~