RE: [PHP-DB] Supress MySQL error messages...

2003-05-27 Thread Hutchins, Richard
Matt,

The only thing I could think of is that since it's the mysql function that
you don't want to return the error, it's cleaner to put the @ right before
the function call. That way it's crystal clear what's not supposed to return
the error.

And John was right, I incorrectly referred to the @ as an ampersand (which
is &). However, for amusement, I looked it up on dictionary.com. Here's what
it says the @ sign is called:

 "@". ASCII code 64. Common names: at sign, at,
strudel. Rare: each, vortex, whorl, INTERCAL: whirlpool,
cyclone, snail, ape, cat, rose, cabbage, amphora. ITU-T:
commercial at.

I like strudel.

Rich
> -Original Message-
> From: Matthew Horn [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 27, 2003 11:54 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Supress MySQL error messages...
> 
> 
> > Ex.
> > $number = @mysql_num_rows($result_var);
> > 
> > Having a bit of a brain cramp right now as I normally do 
> not suppress
> > errors. My apologies if I'm wrong.
> 
> The at sign works fine for suppressing error messages from 
> mysql, but I usually have it at the beginning of the 
> assignment, as in:
> 
> @ $number = mysql_num_rows($result_var);
> 
> Is there any reason to do this versus the way Richard 
> mentioned (having the @ before the mysql statement)? 
> 
> Are there any downsides to doing this at all? I understand it 
> can make you lazy later on and not bother doing error 
> checking, for one...
>  
> matt
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Supress MySQL error messages...

2003-05-27 Thread Matthew Horn
> Ex.
> $number = @mysql_num_rows($result_var);
> 
> Having a bit of a brain cramp right now as I normally do not suppress
> errors. My apologies if I'm wrong.

The at sign works fine for suppressing error messages from mysql, but I usually have 
it at the beginning of the assignment, as in:

@ $number = mysql_num_rows($result_var);

Is there any reason to do this versus the way Richard mentioned (having the @ before 
the mysql statement)? 

Are there any downsides to doing this at all? I understand it can make you lazy later 
on and not bother doing error checking, for one...
 
matt

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Supress MySQL error messages...

2003-05-27 Thread CPT John W. Holmes
> Does anyone know if it is possible to suppress MySQL error messages?
> 
> For example
> 
> 
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /var/www/killerspin/public/preview_checkout.php on line 25

Stop using mysql functions on invalid result sets?
 
> This is just for testing...

Oh, in that case, use @

$num = @mysql_num_rows($rs);

---John Holmes...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php