Setup Array to check tables
PHP and MySQL.
I want to specify about 10 tables that should be checked before the application starts, since if they are empty the results are not so good!
Here is what I have so far:
//specify what tables we want to check
$db_array =
array("attendance_codes","ethnicity","generations","grades","grade_terms","health_codes",$
//walk the array checking each table for more than 0 records
while $db_array {
// Build SQL Query
$query = "select * from $db_array";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
if ($numrows==0) {
msgFormErr = msgFormErr + "Table $db_array is empty";
}}
I know it's bad because it's not working, lol! So while I dig through my 1000 page PHP book, maybe someone can get me going a little faster!
Thank you.
|