Re: PHP4 MSSQL Error handling
| From: | Salve Tinkerworth | Date: | Thu, 25 Jul 2002 00:11:47 +0000 |
| Subject: | Re: PHP4 MSSQL Error handling | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20763@lists.php.net to get a copy of this message | ||
This is what was there before I tried to replace it:
$sql2=mssql_query($sql2) or die ('failed inserting OPS');
This didn't work. It died everytime even though I could run the statement in
$sql2 in query analyzer without any problems. I inherited this thing but I'm
having fun learning PHP. :-)
Salve
"Doug Durham" <ddurham@metroed.net> wrote in message
news:5.1.0.14.0.20020724170347.00b364e8@pop.metroed.net...
> $result=mssql_query($sql2)or die("sql2 failed<br>" . mysql_errno() . ":
> "
.
> mysql_error());
>
> At 04:48 PM 7/24/2002 -0700, Salve Tinkerworth wrote:
> >Does anyone have any good tips for error handling? I've tried different
> >methods to retrieve good error information from mssql_query but nothing
> >seems to be working.
> >
> >Here's the latest attempt:
> >
> >$result=mssql_query($sql2);
> >$result=mssql_query('SELECT @@ERROR As ErrorCode');
> >$error=mssql_fetch_row($result);
> >if($error['ErrorCode'] != 0) {
> > echo $error['ErrorCode'];
> > echo $sql2;
> > die('Inserting OPS failed');
> >}
> >
> >
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>