<?php
include_once("c_mysql.php");
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "mysql";
$table = "db";
//create a c_mysql object
$mysql_obj = new c_mysql($host, $user, $pass, $db);
//get data from the database
$mysql_data = $mysql_obj->c_mysql_SELECT($table, "*");
//print the data
echo "data as an array:<br>\n";
echo "<pre>\n";
print_r($mysql_data);
echo "</pre>\n<br><br>";
//change the return format
$mysql_obj->c_mysql_set_format("xml");
//get data from the database
$mysql_data = $mysql_obj->c_mysql_SELECT($table, "*");
//print the data
echo "data as an xml (view source):<br>\n";
echo "<pre>\n";
print_r($mysql_data);
echo "</pre>\n<br><br>";
?>
</body>
</html>
|