My plan was to store some of my content in a MySQL Database. I was wondering if the following code will work.
$filename = $QUERY_STRING;
$server = "localhost";
$db_user = "root";
$db_pass = "password";
$database = "projects";
mysql_connect($server, $db_user, $db_pass) or die ("Database Connect Error");
$sql = "SELECT content FROM pages WHERE filename = '$filename' LIMIT 1";
$content_results = mysql_query($sql);
$content = mysql_fetch_array($content_results);
$str = $content[content];
mysql_close();
Print($str);
?>
The database is projects
table is pages
and the columns are
filename char(20)
content text || blob
I have placed index in the filename column and a HTML page in the content column.
Does anyone see any problems with this code???