RE: Handling DB query errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



function db_get_member_data($dbh, $member_id) {
   $stmnt = "SELECT * FROM Member WHERE MEM_MEM_ID='" . $member_id . "'";
   $sthdl = ibase_query($stmnt,$dbh);

   if ( ibase_errcode != 0 ){
      //call some function to tell the user there is an error
   }else{

   return $sthdl;
   }//end if
 }

bastien


From: Todd Cary <todd@xxxxxxxxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject:  Handling DB query errors
Date: Fri, 24 Dec 2004 08:40:40 -0800

I am not sure about how to properly handle DB Query errors. Here is a typical query where the possible is NOT handled. Any suggestions are welcomed e.g. how to code the query; how to have an error page; how to handle errors produced by the Interbase server.

 /* Get member data */
  function db_get_member_data($dbh, $member_id) {
    $stmnt = "SELECT * FROM Member WHERE MEM_MEM_ID='" . $member_id . "'";
    $sthdl = ibase_query($stmnt,$dbh);
    return $sthdl;
  }

Todd
--

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux