Basically, I'm trying to organize my code cleaner. I have a bunch of SQL queries which I am storing in a file called Queries.PHP. Example:
//Queries.php
//Connects to Database
$dbh=mysql_connect ("localhost", "~", "~") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("~") or ("Database not found");
function hi3() {
$query = "SELECT AVG(NULLIF(`~`, 0)) FROM `~` WHERE `~` BETWEEN '~' AND '~';";
$result = mysql_query($query) or die ( $result.mysql_error());
$row = mysql_fetch_array($result);
echo "~";
}
Then, on a separate page, I have code that is building HTML table headers and a separate function building the contents:
include Queries.php;
function BuildHTMLTableHeaders {
echo HTML table headers;
BuildHTMLTableBody();
echo </table>;
}
function BuildHTMLBody {
echo <tr>;
echo <td>;
hi3();
echo </td>;
echo </tr>;
...
}
Now, here's my problem: when I call hi3(), the rest of the table doesn't build. Why?