jc_gmk
06-12-2007, 01:18 PM
I'm new to MySQL and PHP.
Is it a good Idea to store content within a MySQL database?
Is it search engine friendly?
for example I have created some news pages that call data from a database.
essencially they are just static html pages with some php.
My thinking behind doing it this way is that I can create a search box to search all the content on my website.
e.g.
<?php
mysql_connect("mydomain.com", "username", "password") or die(mysql_error());
mysql_select_db("databasename") or die(mysql_error());
?>
<?php
$data = mysql_query("SELECT * FROM mytable WHERE id='news1'") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
print "<span class=\"newsheading1\">" . $info['title'] . "</span><br /><br />";
print $info['content'];
}
?>
Is it a good Idea to store content within a MySQL database?
Is it search engine friendly?
for example I have created some news pages that call data from a database.
essencially they are just static html pages with some php.
My thinking behind doing it this way is that I can create a search box to search all the content on my website.
e.g.
<?php
mysql_connect("mydomain.com", "username", "password") or die(mysql_error());
mysql_select_db("databasename") or die(mysql_error());
?>
<?php
$data = mysql_query("SELECT * FROM mytable WHERE id='news1'") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
print "<span class=\"newsheading1\">" . $info['title'] . "</span><br /><br />";
print $info['content'];
}
?>