...place the main script file "phpmyviews.php" in a folder somewhere on your webspace. Note the path to it.
...then put the config file "pmv_config.php" into your working folder, where you want to generate the data views. Adjust the path to the script file in the last lines of "pmv_config.php".
Run the script by typing the URL of your "pmv_config.php" script in your webbrowser.
Here's a listing for a simple MySQL query and the corresponding output.
<?php
# MySQL Parameters
$pmv_db_host="host";
$pmv_db_name="db";
$pmv_db_user="user";
$pmv_db_pass="pass";
if (file_exists('pmv_db_config.php')) {
include('pmv_db_config.php');
}
# Actions
$pmv['default'][0]['sql']='SELECT * FROM addresses ORDER BY surname';
$pmv['default'][0]['pre']='<table>
<tr><th>Name</th><th>Address</th><th>Telephone</th></tr>';
$pmv['default'][0]['main']='<tr><td>$surname, $prename</td><td>$address</td><td>$telephone</td></tr>';
$pmv['default'][0]['post']='</table>';
# execute phpMyViews
//$path_to_pmv=$_SERVER['DOCUMENT_ROOT']."/phpmyviews.php";
$path_to_pmv="phpmyviews.php";
include($path_to_pmv);
?>
Let's have a closer look on this:
That's it. The script executes a MySQL query and, after printing a table header, shows all the entries of the query result and finally prints a table footer. Isn't it easy ?