[Fwd: [PHPLIB] Brain Fart...] From: Rod Taylor (rodt <email protected>)
Date: 03/15/00

BTW.. I too prefer lists where the mailing list is the return address :)

attached mail follows:


  $getsid = new DB_Article;
  $query = "select nextval('result_seq')";
  $getsid->query($query);
  $sid = $getsid->f(0);

$print "HERE::$sid";

I get 'HERE::'.

The query does infact increase the value of result_seq which is expected if
the query is performed properly.

Now, how to get the pesky information back out of the thing.

psql shows:

nextval
----------
10433
(1 row)

I tried $sid = $getsid->f('nextval'); withthe same results.

Michael Anthon wrote:

> *mutter* .. I prefer lists wehre teh return address is the list, not the
> originator 8^)
>
> The column name passed into the db->f() function is actually used as an
> index into an associative array like this...
>
> function f($Name) {
> return $this->Record[$Name];
> }
>
> Therefore, you can simply use an integer (0 based) to return columns. In
> your case, there should be only one column in the result, so
> $variable = $getsid->f(0);
> should give you what you want.
>
> Cheers
> Michael Anthon
>
> > -----Original Message-----
> > From: Rod Taylor [mailto:rodt <email protected>]
> > Sent: Thursday, 16 March 2000 2:26 AM
> > To: phplib <email protected>
> > Subject: [PHPLIB] Brain Fart...
> >
> >
> > Today is one of those days....
> >
> > Queries work fine from tables, but the below is having problems.
> >
> > $getsid = new DB_Article;
> > $query = "select nextval('result_seq')";
> > $getsid->query($query);
> >
> > The query actually works as advertised, but how do I go about getting
> > the returned value?
> >
> > Normally its $variable = $getsid->f("????");
> >
> > But, in this case there is no column name (or is there?).
> >
> > Thanks!
> >
> > -
> > PHP3 Base Library Mailing List. Send messages to
> > <phplib <email protected>>.
> > To unsubscribe, send "unsubscribe" to
> > <phplib-request <email protected>> in
> > the body, not the subject, of your message.
> >
> -
> PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
> To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
> the body, not the subject, of your message.

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.