[thelist] MySQL as CMS
Michael Barrett
mbarrett at triad.rr.com
Wed Nov 6 07:28:00 CST 2002
Hello Listeroos
I am in the midst of planning a new web site project and thinking about how
to manage content.
This web site will include a library of articles and a product catalog,
along with the usual about us, contact, policies, etc.
I was thinking that Library articles and the product data should naturally
be stored in a database. Then I got to thinking...
"Hey. Why can't I just put all the content in the database?"
I began scheming how I might put all the sites content in the database, then
access each section of the site with one template and a query string.
I imagine a simple administrative tool allowing the client, or myself to
update the content of the site without managing a bunch of scattered HTML
files.
Are there any faults in this approach that I am not seeing?
This will not be a particularly high traffic site, so I am not concerned
about taxing the data base.
<tip type="php/mysql" author="Michael Barrett">
If you need to count the number of rows returned by a mysql query. Don't
write code for it. Simply select a COUNT on the rows you need counted.
$sql = "select count(row_I_wanna_count) where some_condition=\"something\"";
$result = mysql_query($sql,$db_connection);
While ($row = mysql_fetch_array($result)) {
$count = $row["count(row_I_wanna_count)"];
}
$count = number of rows
</tip>
--
Michael Barrett
-O^O-
-
mbarrett at triad.rr.com
More information about the thelist
mailing list