<script language="php">
 #
 # this include file has the passwords and 
 # database names defined in it  
 #
 require('../sql_passwords.php');
 echo "<h1>SQL select statements</h1>\n";
 #
 # connect to SQL
 #
 $link = mysql_connect($z_hardcoded_sqlurl, 
                       $z_hardcoded_database, 
                       $z_hardcoded_password )
                       or die('Could not connect: ' . mysql_error());
 #
 # select the database I want to use
 #
 mysql_select_db($z_hardcoded_database) or die('Could not select database');
 echo "<table border=0>\n";




 echo "<tr><td>\n";
 #
 # select some stuff from the database
 #
 $query = 'SELECT name, count FROM `counters` ';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query<p></td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td><td>\n";
 

 $query = 'SELECT name, count FROM `counters` order by name, count';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 $query=preg_replace ( '/order /i', '<br>&nbsp;order ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query</td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td><td>\n";
 $query = 'SELECT name, count FROM `counters` order by  count,name';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 $query=preg_replace ( '/order /i', '<br>&nbsp;order ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query</td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td></tr>\n";
 echo "<tr><td>\n";
 #
 # select some stuff from the database
 #
 $query = 'SELECT name, count FROM `counters` where name like \'c%\' ';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from /i', '<br>&nbsp;from ', $query);
 $query=preg_replace ( '/where /i', '<br>&nbsp;where ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query<p></td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td><td>\n";
 $query = 'SELECT name, count FROM `counters`  where name like \'c%\' order by name,  count';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 $query=preg_replace ( '/where /i', '<br>&nbsp;where ', $query);
 $query=preg_replace ( '/order /i', '<br>&nbsp;order ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query</td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td><td>\n";
 $query = 'SELECT name, count FROM `counters` where name like \'c%\' order by   count,name';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 $query=preg_replace ( '/where /i', '<br>&nbsp;where ', $query);
 $query=preg_replace ( '/order /i', '<br>&nbsp;order ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query</td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td></tr>\n";
 echo "<tr><td>\n";
 #
 # select some stuff from the database
 #
 $query = 'SELECT name, count FROM `counters` where name=\'c\' ';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from /i', '<br>&nbsp;from ', $query);
 $query=preg_replace ( '/where /i', '<br>&nbsp;where ', $query); 
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query<p></td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td><td>\n";
 $query = 'SELECT name, count FROM `counters`  where name=\'c\' order by name, count';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 $query=preg_replace ( '/where /i', '<br>&nbsp;where ', $query);
 $query=preg_replace ( '/order /i', '<br>&nbsp;order ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query</td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td><td>\n";
 $query = 'SELECT name, count FROM `counters` where name=\'c\' order by  count,name';
 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
 $query=preg_replace ( '/from/i', '<br>&nbsp;from', $query);
 $query=preg_replace ( '/where /i', '<br>&nbsp;where ', $query);
 $query=preg_replace ( '/order /i', '<br>&nbsp;order ', $query);
 #
 # display the selected stuff
 #
 echo "<table border=2>\n";
 echo "<tr><td colspan=2>$query</td></tr>";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<tr>\n";
    foreach ($line as $col_value) {
        if ($col_value == '' ) {
           $col_value='&nbsp;';
        }
        echo "<td>$col_value</td>\n";
    }
    echo "</tr>\n";
 }
 echo "</table>\n";
 #
 # i am not sure but i think this frees the
 # stuff associated with the current select so
 # you can do a new select
 #
 // Free resultset
 mysql_free_result($result);
 echo "</td></tr>\n";
 echo "</table>\n";
 #
 # close the SQL connection
 #
 // Closing connection
 mysql_close($link);
</script>