Re: Odp: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Hans-Werner Guth

We do it this way (code snippet)

...
$dbqueryline = mysql_db_query ($mredatabase,
   "select vorgang, bezeichnung 
   from mrebewkennz 
   order by vorgang", $dbhandle);
if (mysql_errno() != 0)
{
   echo mysql_error(); echo "\n";
}
else
{
   $bewkenznzahl = mysql_num_rows($dbqueryline);
   print "$bewkenznzahl Bewegungskennzeichen\n";
}

Bartek Pawlik wrote:
 ...snipp...
 
  I normally do something like:
 
  $sql = "SELECT something FROM table";
  $result = mysql_query($sql);
  if(@mysql_num_rows($result)  0) {
  echo'Query Suceeded';
  } else {
  echo'Query failed';
  }
...snipp...

-- 
Hans-Werner Guth  S http://www.qits.de
 QITS GmbH  T mailto:[EMAIL PROTECTED]
Formerstr 53  I fon +49-2102-852-145
40878 Ratingen  Q fax +49-2102-852-202

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Doug Semig

I see you there's been lots of responses already, but there's an important
related bit of news folks might want to know.

Everyone who uses the mysql_affected_rows() should know that a bug was
fixed in 3.23.36 that evidentally reports affected rows incorrectly if
MySQL was compiled without support for transactions.  Go to
http://www.mysql.com/documentation/mysql/bychapter/manual_News.html and
scroll down to section F.2.2.  It's the 8th item in the list.

So shy away depending on mysql_affected_rows() for anything unless you're
absolutely sure you're running at least 3.23.36 or have transaction support
compiled in.

Doug

At 12:00 PM 3/29/01 +0100, Jordan Elver wrote:
Hi,
i was just wondering what you guys do to check if a wquery suceeded or not?
I know about mysql_num_rows() and mysql_affected_rows(), just wondered what 
you guys do?

I normally do something like:

$sql = "SELECT something FROM table";
$result = mysql_query($sql);
if(@mysql_num_rows($result)  0) {
   echo'Query Suceeded';
} else {
   echo'Query failed';
}

Cheers,

Jord



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Best way to check if a query succeeded

2001-03-29 Thread Jordan Elver

Hi,
i was just wondering what you guys do to check if a wquery suceeded or not?
I know about mysql_num_rows() and mysql_affected_rows(), just wondered what 
you guys do?

I normally do something like:

$sql = "SELECT something FROM table";
$result = mysql_query($sql);
if(@mysql_num_rows($result)  0) {
echo'Query Suceeded';
} else {
echo'Query failed';
}

Cheers,

Jord

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]