LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-09-2010, 07:19 PM   #1
dougp25
Member
 
Registered: Dec 2003
Location: Seacoast NH
Distribution: PCLinuxOS
Posts: 37

Rep: Reputation: 2
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.
 
Old 11-09-2010, 07:31 PM   #2
dougp25
Member
 
Registered: Dec 2003
Location: Seacoast NH
Distribution: PCLinuxOS
Posts: 37

Original Poster
Rep: Reputation: 2
Oops, never you mind! A little basic array work and I'm on my way!

Sorry! Maybe an admin can delete the thread please!
 
Old 11-10-2010, 12:44 AM   #3
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
a query of select count(*) from $db_array might suit you better.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk Error in Raid array file system inode tables. jpbland51 Linux - Newbie 6 05-21-2008 06:27 AM
Router Setup -IP Tables Masquerading bk_bharani Linux - Networking 5 07-22-2005 09:42 AM
Router Setup -IP Tables Masquerading zhex900 Linux - Networking 3 07-04-2005 05:06 AM
IP TABLES setup RecoilUK Linux - Networking 3 12-13-2001 03:04 AM
IP Tables setup help RecoilUK Linux - Networking 2 12-07-2001 08:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration