What is the right way to save (php, html, js and mysql) code in database
+3
A:
D'oh! Are you sure you want to do that? How are you going to version that and work with that code from within an IDE?
However, if you're really inclined to, just keep it in whatever CLOB your DBMS supports.
Anton Gogolev
2010-02-12 13:59:03
+1
A:
As you didn't provide any other info:
$mycode = '<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
...
</body>';
mysql_query("INSERT INTO table SET mycode = '".mysql_real_escape_string($mycode)."');
I seriously doubt you want to do this, though.
Tatu Ulmanen
2010-02-12 13:59:43