Re: [phplib] Returning an error message From: Arno A. Karner (karner <email protected>)
Date: 10/21/00

Maurice Jumelet wrote:
>
> after the query check for
> if ($db->nf() == 0) {
> die("That ID does not exist!");
> }
>
> Maurice
> NOXX.COM
>
db->nf or db-> num_rows are not supported by all db abstractions
but if(!$db->next_record()) {
        die("That ID does not exist!");
}
should work on more diffrent types db abstractions then the above method
 
> ----- Original Message -----
> From: "Peter Bowyer" <reywob <email protected>>
> To: <phplib <email protected>>
> Sent: Saturday, October 21, 2000 11:05 AM
> Subject: [phplib] Returning an error message
>
> > Hi,
> >
> > I have the following piece of code in a script:
> > $query = "SELECT * FROM $tbl_name where id=".$id;
> > $db->query($query);
> >
> > My problem is if the ID doesn't exist, it doesn't return an error, and
> just
> > carries on printing the page without any code in it. See what I mean at
> > <http://www.sendcard.f2s.com/demo/sendcard.php?view=1&id=1234>
> >
> > This gives the user no indication of what is wrong. How can I check
> > whether the $db->query($query); has extracted a row from the database or
> > not? Does $db return 0 or something?
> >
> > Thanks,
> > Peter.
> > --oOo--
> > Narrow Gauge on the web - photos, directory and forums!
> > http://www.narrowgauge.f2s.com
> > --oOo--
> > Peter's web page - Scottish narrow gauge in 009
> > http://members.aol.com/reywob/
> > --oOo--
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> > For additional commands, e-mail: phplib-help <email protected>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>

-- 
My opinions are my own and not that of my employer even if I am self
employed
Tech Net, Inc.            --FREE THE MACHINES--                 
651.224.2223
627 Palace Ave. #2           karner <email protected>              
karner <email protected>
St. Paul, MN 55102-3517        www.tnss.com         
wanted    : adsl/cable modem with static ip at reasonable price
accept-txt: us-ascii,html,pdf
accept-dat: ascii-delimited,sql insert statments

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>