Re: Postgre RAISE NOTICE and PHP

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Andre Lopes <lopes80andre(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgre RAISE NOTICE and PHP
Date: 2009-08-18 20:45:46
Message-ID: dcc563d10908181345k3bc840a9w1dd8ccb4c79d74b8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 18, 2009 at 10:57 AM, Andre Lopes<lopes80andre(at)gmail(dot)com> wrote:
> Hi,
>
> I'm developing a function with some checks, for example... to check if the
> e-mail is valid or not.
>
> If the e-mail is not valid I put a line with RAISE NOTICE 'E-mail not
> valid'.
>
> I need to know if it is possible to show this RAISE NOTICE when I run this
> function from PHP.

http://www.php.net/manual/en/function.pg-last-notice.php

example plpgsql function:
create or replace function tester() returns int language plpgsql as $$
BEGIN
raise notice 'whoops';
return 1;
END
$$;

example php:
<?php
$conn = pg_connect("dbname=smarlowe");
$res = pg_query("select tester()");
print pg_last_notice($conn);
print "\n";
?>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andre Lopes 2009-08-18 21:22:01 Access Control System - Design
Previous Message Bill Moran 2009-08-18 20:33:15 Re: Any justification for sequence table vs. native sequences?