Re: isset not working with select [message #181363 is a reply to message #181342] |
Mon, 13 May 2013 19:54 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Mon, 13 May 2013 07:01:46 -0400, richard wrote:
> What to use to do that?
Programming skills and logic.
Perhaps you could check that the returned elements contain some viable
data after checking if they're set, and if they don't contain such
expected viable data, then you could output something else?
Given:
$cov = mysql_fetch_row($result);
Then:
if ( isset( $cov[0], $cov[1] ) && is_string( $cov[0] ) && is_string( $cov
[1] ) && strlen( $cov[0] ) > 4 && strlen( $cov[1] ) > 4 ) {
// here you use $cov[0] and $cov[1] in the output
} else {
// here you have an alternative output
}
Now please note carefully:
The order of multiple tests in an if statement as shown above can be
critical to prevent errors. Don't change it around!
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|