Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Error code of one query
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 13th October 04:03
jromagos
php
Mombu User
 
Join Date: Oct 2008
Location: spain
Posts: 1
jromagos is on a distinguished road
Default Error code of one query



Someone can say me if this is the better way to know the error code of one query? I read it can do with pg_send_query and then read with pg_get_result but sometimes it doesn't works me. And trying and reading I wrote the PHP code below, but I belive it's a horrible code. It's possible do the same with pg_query instruction? And if it's the only way, this is the good solution? And how many iterations it's good?
PHP Code:
$send_query= @pg_send_query($connection,$SQL);
if (
$send_query){
$i=0;
do
{
            
$i++;
            
$this->result = @pg_get_result($connection);
}while (
$i MAX_ITERATIONS && $this->result === FALSE );

if (
$this->result === FALSE){
                return (
FALSE);
}
if (
pg_result_status($this->result) === PGSQL_FATAL_ERROR)
{
  
// Error case...
   
$error_code = @pg_result_error($this->result);
}


Thanks in advance, Jordi
jromagos is offline   Reply With Quote


 


Reply


Thread Tools
Display Modes




666