Re: mysql apache - page never finish loading
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Tue, 11 Jul 2006 17:28:30 -0400
Mel wrote:
On 2006-07-10 10:00:41 +1000, "flamer die.spam@xxxxxxxxxxx" <die.spam@xxxxxxxxxxx> said:
i would stick in an ' or die (mysql_error ()); ' at the end of the
statement, probably is coming across an error but for some reason keeps
trying.. you really should have that on all your sql queries.
Flamer.
I'm curious: why should you always have one on SQL function calls? I never use them and opt for things like:
$link = @mssql_connect(CONNECTION_STUFF_HERE);
if ($link === false) {
// handle error
}
if (@mssql_select_db(DBNAME,$link) === false) {
// handle error
}
$sql = "select * from myTable";
$res = @mssql_query($res);
if ($res === false) {
// handle error
}
Normally this'd be in a class and '// handle error' would throw an Exception. This method is used heavily in my production environment and has yet to fail me. I'm not poo-pooing the idea of the die() or exit() functions inline with the SQL functions, just wondering why they should be used.
Mel,
I'm with you. I don't use "or die..." either. I'd rather check the results, and if they aren't good, handle the problem.
It's very unsettling to a user to have your pages break because of some minor database problem. It's even worse to have the error message displayed in their browser. Better to log the error and put up something like "I'm sorry but we're having problems right now" type of message.
And for production machines I can even have it email me the error so I know something bad happened. Saves having to look through error logs.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- mysql apache - page never finish loading
- From: theGreatGnu
- Re: mysql apache - page never finish loading
- From: Alvaro G. Vicario
- Re: mysql apache - page never finish loading
- From: theGreatGnu
- Re: mysql apache - page never finish loading
- From: flamer die.spam@xxxxxxxxxxx
- Re: mysql apache - page never finish loading
- From: Mel
- mysql apache - page never finish loading
- Prev by Date: Re: applications with sales tax rates
- Next by Date: Re: htmlentities & charencoding
- Previous by thread: Re: mysql apache - page never finish loading
- Next by thread: Re: mysql apache - page never finish loading
- Index(es):
Relevant Pages
|