Re: mysql apache - page never finish loading



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
==================
.



Relevant Pages

  • Re: What is wrong?
    ... snipped too much of that response; look again;-) The quoted snippet to ... about how to setup to call the procedure to test and debug -- using SQL. ... procedure from RPG when it could be done simply instead, ... Another would be to create an SQL function, either using the SQLP language or SQLRPGLE. ...
    (comp.sys.ibm.as400.misc)
  • Re: Obtaining SQL insert auto generated key from query within JSP
    ... Do a search on that sql function, ... The SQL for retrieving a serial number assigned by the DBMS is very specific to the DBMS. ... I've not used JSP so if JSP magically unifies this, that would be surprising but welcome! ... I couldn't find anything in the JSTL SQL section to allow access to the statement, which is what Derby uses to get generated keys. ...
    (comp.lang.java.programmer)
  • Re: mysql apache - page never finish loading
    ... probably is coming across an error but for some reason keeps ... you really should have that on all your sql queries. ... why should you always have one on SQL function calls? ...
    (comp.lang.php)
  • Re: convert Money to Words
    ... All our applications are web based. ... And they are using MS report server to ... > not in SQL, that translates the number into words. ... >> there an SQL function that can do this or am I going to have to write the ...
    (microsoft.public.sqlserver.programming)
  • Re: sqlservr.exe doesnt stop
    ... No,but I got a lot of error logs indicate someone try to ... If set SQL to manully start,everything OK before SQL ... >>>won't let me restart again. ... >>>computer but as soon as I tried to access SQL Server I ...
    (microsoft.public.sqlserver.security)