Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old January 17th, 2007, 03:15 AM
user
Guest
 
Posts: n/a
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
  #2  
Old January 17th, 2007, 06:45 AM
=?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=
Guest
 
Posts: n/a

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)
  #3  
Old January 17th, 2007, 06:45 AM
Kimmo Laine
Guest
 
Posts: n/a

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)


  #4  
Old January 17th, 2007, 04:35 PM
user
Guest
 
Posts: n/a

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 Threads
Thread Thread Starter Forum Replies Last Post
uploading several docs at once Chris answers 5 August 9th, 2006 10:15 PM