PDA

View Full Version : storing content in MySQL database



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'];
}
?>

boogyman
06-12-2007, 04:31 PM
Is it a good Idea to store content within a MySQL database?
yes

Is it search engine friendly?
define search engine friendly... if you are asking if you implement a search engine will it work? that all depends on how you design and implement.
as for whether its viable for outside search engines eg (google, yahoo ...) yes it is very much adaptable to those as well.