By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,641 Members | 1,685 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,641 IT Pros & Developers. It's quick & easy.

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

P: 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
Jan 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
user wrote:
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ø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Jan 17 '07 #2

P: n/a
"user" <so*****@someplace.orgwrote in message
news:6o*********************@bgtnsc04-news.ops.worldnet.att.net...
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
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Jan 17 '07 #3

P: n/a
Thanks to both of you.

Kimmo Laine wrote:
"user" <so*****@someplace.orgwrote in message
news:6o*********************@bgtnsc04-news.ops.worldnet.att.net...
>>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.
Jan 17 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.