Checking for existance for data in a column
Hi!! I have a CGI that looks up data from a mysql data base and does a bunch of calculations. I only want to do calculations on the columns which contains any data. What I mean is for some colums there is no data available at all. So I don't want to do any calculations on them obviously. How do I check whether the column contains data, once I have retrived all the data using fetchrow_hashref(). Thanks and Cheers alway!! Murli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checking for existance for data in a column
On Tue, 3 Dec 2002 at 09:36, T. Murlidharan Nair opined: TMN:any calculations on them obviously. How do I check whether TMN:the column contains data, once I have retrived all the data TMN:using fetchrow_hashref(). you probably should ask on a dbi list. http://www.isc.org/services/public/lists/dbi-lists.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checking for existance for data in a column
You can most likely preclude empty/invalid data with SQL. Let's say your field/column name is 'name'. Then with your DBI prepare() call, you can preclude records where name is blank, null, or whatever you'd like. $sth = $dbh-prepare( 'SELECT * FROM table WHERE name IS NOT NULL' ); $sth-execute; # Proceed with your fetchrow_hashref()'s, etc HTH Have Fun! Jason T. Murlidharan Nair [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi!! I have a CGI that looks up data from a mysql data base and does a bunch of calculations. I only want to do calculations on the columns which contains any data. What I mean is for some colums there is no data available at all. So I don't want to do any calculations on them obviously. How do I check whether the column contains data, once I have retrived all the data using fetchrow_hashref(). Thanks and Cheers alway!! Murli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]