You are here: database exception message to user-end information « PHP Programming Language « IT news, forums, messages
database exception message to user-end information

Posted by Yarco on 08/16/07 07:38

When i am coding something, i always need to do some error control on
it.
For example:

<?php

function check()
{
// the following vars from somewhere
if (empty($username))
{
$error['username'] = 'empty user name';
return false;
}
if (//...)
{
}
return false;
}

try
{
// to add a record
}
catch(Exception $e) // but failed, because you can't add record again
some column is uniq.
{
$error['db'] = $e->getMessage();
}

?>

So $error will contain something like:
'db' => "SQLSTATE[23000]: Integrity constraint violation: 1062
Duplicate entry '1-5' for key 'rate_guid_accountId'"

But i want to let user know they do not do such thing but now such
professional words.
How can i do it?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация