Re: [PHP] suppressing errors
What is the error you get? ---John Holmes... - Original Message - From: Preston Wade [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 3:20 PM Subject: [PHP] suppressing errors Hello All, I am trying to use the @ symbol to suppress errors returned by a mysql_query call. This doesn't seem to be working as I get an new page with the error in it in my browser. Any help with this would be greatly appreciated. Here is a snippet of the code I am using $query = select user_id from users where username='$username'; $query_db = @mysql_query($query, $db_connection); $row = @mysql_fetch_array($query_db); if($row) { $message[] = That username is already taken. Please select another.; } else { Thanks, Preston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] suppressing errors
The error is one from mysql stating that I am trying to add a duplicate entry. I would rather handle this in my code hence the following lines in my code. if($row) { $message[] = That username is already taken. Please select another.; } else { Thanks for the response. Thanks, Preston -Original Message- From: 1LT John W. Holmes [EMAIL PROTECTED]@INTERNET@HHC Sent: Thursday, July 25, 2002 2:53 PM To: Preston Wade; [EMAIL PROTECTED] Subject: Re: [PHP] suppressing errors What is the error you get? ---John Holmes... - Original Message - From: Preston Wade [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 3:20 PM Subject: [PHP] suppressing errors Hello All, I am trying to use the @ symbol to suppress errors returned by a mysql_query call. This doesn't seem to be working as I get an new page with the error in it in my browser. Any help with this would be greatly appreciated. Here is a snippet of the code I am using $query = select user_id from users where username='$username'; $query_db = @mysql_query($query, $db_connection); $row = @mysql_fetch_array($query_db); if($row) { $message[] = That username is already taken. Please select another.; } else { Thanks, Preston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] suppressing errors
$query = select user_id from users where username='$username'; $query_db = @mysql_query($query, $db_connection); $row = @mysql_fetch_array($query_db); if($row) { $message[] = That username is already taken. Please select another.; } else { The error is one from mysql stating that I am trying to add a duplicate entry. I would rather handle this in my code hence the following lines in my code. That error message wouldn't come from any of the lines above. You're not INSERTing anything, just SELECTing. Are you sure there isn't another mysql_query() somewhere else without an @ in front of it?? ---John Holmes... - Original Message - From: Preston Wade [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 4:58 PM Subject: RE: [PHP] suppressing errors The error is one from mysql stating that I am trying to add a duplicate entry. I would rather handle this in my code hence the following lines in my code. if($row) { $message[] = That username is already taken. Please select another.; } else { Thanks for the response. Thanks, Preston -Original Message- From: 1LT John W. Holmes [EMAIL PROTECTED]@INTERNET@HHC Sent: Thursday, July 25, 2002 2:53 PM To: Preston Wade; [EMAIL PROTECTED] Subject: Re: [PHP] suppressing errors What is the error you get? ---John Holmes... - Original Message - From: Preston Wade [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 25, 2002 3:20 PM Subject: [PHP] suppressing errors Hello All, I am trying to use the @ symbol to suppress errors returned by a mysql_query call. This doesn't seem to be working as I get an new page with the error in it in my browser. Any help with this would be greatly appreciated. Here is a snippet of the code I am using $query = select user_id from users where username='$username'; $query_db = @mysql_query($query, $db_connection); $row = @mysql_fetch_array($query_db); if($row) { $message[] = That username is already taken. Please select another.; } else { Thanks, Preston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] suppressing errors with @
Thanks! I also think it might be a bug. I reported it as a bug report. Uri. Miguel Cruz wrote: On Sat, 6 Jul 2002, Uri Even-Chen wrote: I tried to suppress warnings in isset expressions (Uninitialized string offset warnings). The original line was something like this: if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME']))) When I added the sign like this: if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME']))) My program stopped working, and I got errors like: PHP Parse error: parse error, expecting `T_VARIABLE' or `'$'' Eventually, I put the in this place: if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME']))) Which works, but why didn't it work the other way? Is it some kind of PHP bug? It does seem to be a disagreement with the manual: http://www.php.net/manual/en/language.operators.errorcontrol.php There it says that you can stick before a variable name. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] suppressing errors with @
On Sat, 6 Jul 2002, Uri Even-Chen wrote: I tried to suppress warnings in isset expressions (Uninitialized string offset warnings). The original line was something like this: if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME']))) When I added the sign like this: if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME']))) My program stopped working, and I got errors like: PHP Parse error: parse error, expecting `T_VARIABLE' or `'$'' Eventually, I put the in this place: if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME']))) Which works, but why didn't it work the other way? Is it some kind of PHP bug? It does seem to be a disagreement with the manual: http://www.php.net/manual/en/language.operators.errorcontrol.php There it says that you can stick before a variable name. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php