Connecting Tech Pros Worldwide Forums | Help | Site Map

showerror() vs mysql_error() ..... difference

user
Guest
 
Posts: n/a
#1: Jan 17 '07
Could someone give me the quick difference betweeen the 2 error
functions and why one should use one or the other.



if (!mysql_select_db($database, $connection))
showerror();

$connection = mysql_connect('mysql_host', 'mysql_user', mysql_password')
or die('Could not connect: ' . mysql_error());


TIA

=?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=
Guest
 
Posts: n/a
#2: Jan 17 '07

re: showerror() vs mysql_error() ..... difference


user wrote:
Quote:
Could someone give me the quick difference betweeen the 2 error
functions and why one should use one or the other.
>
if (!mysql_select_db($database, $connection))
showerror();
>
$connection = mysql_connect('mysql_host', 'mysql_user',
mysql_password') or die('Could not connect: ' . mysql_error());
Since the PHP manual doesn't list a function named showerror(), I can
only guess that it's a user-created function (ie. created by whoever
wrote the script), while mysql_error() is a built-in function that
retrieves the last error message from MySQL (or a blank string if the
last query/access was successful).

--
Kim André Akerø
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Kimmo Laine
Guest
 
Posts: n/a
#3: Jan 17 '07

re: showerror() vs mysql_error() ..... difference


"user" <someone@someplace.orgwrote in message
news:6ogrh.739663$QZ1.371372@bgtnsc04-news.ops.worldnet.att.net...
Quote:
Could someone give me the quick difference betweeen the 2 error functions
and why one should use one or the other.
>
>
>
if (!mysql_select_db($database, $connection))
showerror();
>
$connection = mysql_connect('mysql_host', 'mysql_user', mysql_password')
or die('Could not connect: ' . mysql_error());

mysql_error is a built-in function, comes in the package, and showerror is
something used only in the php project you are working with. Ask the person
who wrote the script, it's not a common php function. It's possible that it
has more sophisticated error handling than what mysql_error provides.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)


user
Guest
 
Posts: n/a
#4: Jan 17 '07

re: showerror() vs mysql_error() ..... difference


Thanks to both of you.

Kimmo Laine wrote:
Quote:
"user" <someone@someplace.orgwrote in message
news:6ogrh.739663$QZ1.371372@bgtnsc04-news.ops.worldnet.att.net...
>
Quote:
>>Could someone give me the quick difference betweeen the 2 error functions
>>and why one should use one or the other.
>>
>>
>>
>>if (!mysql_select_db($database, $connection))
>>showerror();
>>
>>$connection = mysql_connect('mysql_host', 'mysql_user', mysql_password')
>>or die('Could not connect: ' . mysql_error());
>
>
>
mysql_error is a built-in function, comes in the package, and showerror is
something used only in the php project you are working with. Ask the person
who wrote the script, it's not a common php function. It's possible that it
has more sophisticated error handling than what mysql_error provides.
>
Closed Thread


Similar PHP bytes