well, i'm not familiar with the database class you are using, but i suggest you become familiar with the php/mysql functions by themselves.
start off by making a connect script. you can use this script in any web app you use and just change the connection variables. i would put your includes in their own folder. here is what a connection script might look like:
PHP Code:
<?
$hostname="localhost";
$mysql_login="myusername";
$mysql_password="mypassword";
$database="mydbname";
if (!($db = mysql_connect("$hostname", "$mysql_login" , "$mysql_password"))) {
print("Can't connect to database.");
} else {
if (!(mysql_select_db("$database",$db))) {
print("Can't connect to table.");
}
}
?>
ok, now i'll use your example above to query and print the results to the screen.
PHP Code:
<?
// the connect script i made above is named
// connect.php and resides in the inc/ directory.
include("inc/connect.php");
// let's put your header.php in the same directory
// just to keep your file structure neat and tidy
include("inc/header.php");
// here is how you execute a query
$result = mysql_query("select * from pages order by code");
// now we can loop through the results and print to the browser
// i don't know the field names of your database table, so i'll make some up
while($row = mysql_fetch_array($result)){
echo "Code: " . $row['code'] . "<br>\n";
echo "Name: " . $row['name'] . "<br>\n";
echo "Text: " . $row['text'] . "<br><hr>\n";
}
// now close the mysql connection
mysql_close();
?>
hope that helps.