Re: Error

From: Marcus Engene <mengpg(at)engene(dot)se>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Error
Date: 2005-12-01 18:23:11
Message-ID: 438F3F8F.3030006@engene.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


> it says...
>
> ERROR: relation "t_customer_cust_id_seq" does not
> exist
>
> i'm off to hunt down the actual name of the sequence.
>
> bottom line - if you get a boolean response, check to
> see if the query has failed first.
>
> thank you for the insight.

Quite a few functions in php do this. If you use the
syntax == or != it is C-style compare. That is, zero
is false and basically the rest is true.

If you use === or !== it evaluates to true if both
the types are equal AND the statement is true.

So, the correct syntax would be

if (false === ($customer_id = $db->getone("..."))) {
error handling.
}

Example from the manual:
// in PHP 4.0b3 and newer:
$pos = strrpos($mystring, "b");
if ($pos === false) { // note: three equal signs
// not found...
}

By doing this, strrpos can return 0 (not an error) or
false (not found). Without === strrpos would have to
return -1 or some other illegal position for not found.

Best regards,
Marcus

In response to

  • Re: Error at 2005-12-01 18:04:22 from operationsengineer1

Browse pgsql-novice by date

  From Date Subject
Next Message ILIAS GOUDAROPOULOS 2005-12-01 20:39:56 Re: PostgreSQL 8.1.0-2 WinXP Services
Previous Message operationsengineer1 2005-12-01 18:04:22 Re: Error