Subject | php.. returning number of rows |
---|---|
Author | Surojit Niyogi |
Post date | 2001-07-02T07:06:03Z |
So, PHP natively supports number of fields. And in the manual shows an example of how this can be used to see whether an empty results set was returned or not. But I try the example (posted below) which does NOT seem to work right.
Does anybody know the BEST method of finding out whether the recordset returned is empty or not? Thanks!
-Surojit
<?php
$dbh = ibase_connect ($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query ($dbh, $stmt);
if (ibase_num_fields($sth) > 0) {
while ($row = ibase_fetch_object ($sth)) {
print $row->email . "\n";
}
} else {
die ("No Results were found for your query");
}
ibase_close ($dbh);
?>
[Non-text portions of this message have been removed]
Does anybody know the BEST method of finding out whether the recordset returned is empty or not? Thanks!
-Surojit
<?php
$dbh = ibase_connect ($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query ($dbh, $stmt);
if (ibase_num_fields($sth) > 0) {
while ($row = ibase_fetch_object ($sth)) {
print $row->email . "\n";
}
} else {
die ("No Results were found for your query");
}
ibase_close ($dbh);
?>
[Non-text portions of this message have been removed]