|
Posted by MaKroZ on 12/16/05 18:52
On Fri, 16 Dec 2005 17:19:03 +0100, Jim wrote:
>>> would like the page to show anyway without any error messages but with an
>>> error e-mail sent to me. This is the code I'm using to connect to the
>> I'd suggest to rewrite your code in something like this:
>>
>> $link = mysql_connect($db_host,$db_user,$db_password);
>> if (!$link) {
>> $message = mysql_error();
>> mail( <-- something to send an email with $message to you --> );
>> echo "a page without any error messages... blah blah blah..";
>> die();
>> }
>> else {
>> mysql_select_db($db_name) or die(mysql_error()); $sql = "<cut>"; $query =
>> mysql_query($sql);
>> $array = mysql_fetch_array($query);
>> mysql_close($link);
>> }
>
> Thanks, I now get the error by e-mail, but the user still sees an error:
> Warning: mysql_connect(): Access denied for user: 'test_username@localhost'
> (Using password: YES) in <cut>/test.php on line 14
>
> How do I hide this error from the user?
Either try to put @ ('at' sign) at the mysql_connect function like:
$link = @mysql_connect($db_host,$db_user,$db_password);
and see if it works...
or switch off the warnings somewhere in config variables, runtime or
global. I'm not sure which ones, I have to look into manuals to find out
the exact way. Shall I? :)
--
nn = MaKroZ =
(oo) My bookmarks:
| | http://www.theisplist.com
|/\| http://www.10pieces.com
Navigation:
[Reply to this message]
|