From: | "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com> |
---|---|
To: | Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl>, Robert Chalmers <robert(at)chalmers(dot)com(dot)au> |
Cc: | psql-general <pgsql-general(at)postgreSQL(dot)org> |
Subject: | RE: [GENERAL] How can I call a function to return a code fragemen tfrom within a pg_Exec |
Date: | 1999-02-02 18:48:44 |
Message-ID: | F10BB1FAF801D111829B0060971D839F637FB1@cpsmail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> -----Original Message-----
> > Original.. This works, but needs calls to three tables.
> Where 'code' actually
> > holds all required info.
> > $result = pg_Exec($database,"select code,title,price
> from catalog where (
> > title like '%$keyword%' and category like '$category' and
> language like
> > '$language') order by code");
> >
> >
> > What I want to do, is just extract the records, that match
> the code, broken
> > down into category, and language.
> > $result = pg_Exec($database,"select code,title,price
> from catalog where (
> > title like '%$keyword%' and (foo($regs[1])) == '$category' and
> > (foo($regs[2])== '$language') order by code");
> > ...................................................................
> > The foo() function is a call to an egreg thing,
> > (ereg( "([0-9]{1,2})([A-Za-z]{1,3})(.*)", $t_code, $regs );)
> > which can return what I'm looking for,
> >
> > I know these error messages are complaining about foo()
> being in the statement,
> > which is what I'm trying to solve.
> > Warning: PostgresSQL query failed: ERROR: No such function
> 'foo' with the
> > specified attributes in
> > /usr/local/apache/share/htdocs/php/book-2.php3 on line 120
> > Warning: 0 is not a PostgresSQL result index in
> > /usr/local/apache/share/htdocs/php/book-2.php3 on line
> > 121
> >
> >
> > Thanks for any clues to this connundrum...
> >
> > Robert
>
> May be I'm wrong, but it seems, that You call inside sql some php
> functions - it of course produce an error.
> So Your code is wrong - I can not give You more precise
> advice, cause I
> don't know what You exactly want to get.
> Rem
>From you previous message and looking at what you have here I don't
think you want to do this but...
If you mean to call function foo before the SQL get's sent to Postgres
try:
$result = pg_Exec($database,
"SELECT code,title,price FROM catalog
WHERE title like '%$keyword%' AND " .
foo($regs[1]) . " = '$category' AND " .
foo($regs[2]) . " = '$language'
ORDER BY code");
You might want to consult my reply to your last method for a better
solution to this.
Hope this helps,
DEJ
From | Date | Subject | |
---|---|---|---|
Next Message | Jackson, DeJuan | 1999-02-02 19:04:07 | RE: [GENERAL] Importing to Postgres from Filemaker Pro |
Previous Message | Jackson, DeJuan | 1999-02-02 18:37:43 | RE: [GENERAL] Inaccessible table?? (fwd) |