I CAN detect if an erro occours. (just some error I did)
I still don't get any return from mysql_errno() or mysql_error()
I don't iether get a return from mysql_errno() or mysql_error() when I do not surpress
with @ (the function, mysql_connect(), then prints a message.)
Guess I could surpress and write the error message myself, but I just want the
original one, wich I should be able to get with mysql_error()
PS. It is only mysql_connect that do it.
Marcus R.
*********** REPLY SEPARATOR ***********
On 20-04-01 at 12:35 David Robley wrote:
>On Fri, 20 Apr 2001 12:19, Marcus Rasmussen wrote:
>> Hello.
>>
>> My question is:
>> How do I detect if mysql_connect() failed when I'm surpressing the
>> error message with @ like $linkid =
>> @mysql_connect("host","user","pass");
>> And how do I, if it failes, get the error message?
>>
>> The manuel says that it:
>> [quote]Returns a positive MySQL link identifier on success, or an error
>> message on failure.[unquote]
>>
>> In my mind I should be able to detect if it returns an errormessage
>> like this: if(!$linkid)
>> $error = mysql_error();
>> or:
>> if(!is_int($linkid))
>> $error = mysql_error();
>> Noone of theese 2 types works :-(.
>> I'm using is_int() because the manuel says that mysql_connect() returns
>> an int. (How can it then return an error message? I thought that an
>> error message would be some kind if string :-).)
>>
>> Here comes another problem, when an error occours I should be able to
>> see the message with mysql_error() (since the linkid not contains an
>> error message.)
>>
>> Marcus R.
>
>Try testing the value of mysql_errno() and echo mysql_error accordingly.
>
>--
>David Robley | WEBMASTER & Mail List Admin
>RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
>AusEinet | http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]