Re: [PHP-DB] Create view and Select in Interbase

2001-03-02 Thread Meir kriheli

On Thursday 01 March 2001 17:37, job sm wrote:
> To all good people,
>
> I've got troubles with the following code:
>
>  $dbh = DbGet(); /*fce na ibase_connect*/
> $stmt1="create view vserv0 as select distinct
> product_id from product where podminka;";
> $sth = ibase_query ($dbh, $stmt1);
> $stmt2="select * from vserv0;";
> $sth = ibase_query ($dbh, $stmt2);
> ?>
>
> It should create a view vserv0 and make a selection
> (select * from ...}. For some reason it process always
> just the first query (create). The second one gives me
> a message "table vserv0 doesn't exist". When I create
> view vserv0 manualy (IB console) it works without any
> problems.
> please help.
>
> Thanks Stephano

PHP's Interbase driver prepares the query even when it's not needed, may 
create views queries can't be prepared, I don't now. 

Try to check to ibase_errmsg() after the first query to see what's happening.

Usually views should be created outside the scripts. Don't use DDL in 
scripts, it's not necessary, and will slow your scripts down. Create the view 
using isql or your favorite management tool and then acesss it in your script.
-- 
Meir Kriheli

  There's someone in my head, but it's not me - Pink Floyd

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Create view and Select in Interbase

2001-03-01 Thread Miles Thompson

Check your Interbase documentation. Normally you create your view as part 
of the database  and then use it like a table, most database's allow 
parameterized views, where, at run time you supply the needed variable.

I'd also think that as both results are passed back to $sth, the execution 
of $stmt2 will clobber the handle to the results obtained in $stmt1.

Miles

At 02:37 AM 3/2/01 +1100, job sm wrote:
>To all good people,
>
>I've got troubles with the following code:
>
>$dbh = DbGet(); /*fce na ibase_connect*/
>$stmt1="create view vserv0 as select distinct
>product_id from product where podminka;";
>$sth = ibase_query ($dbh, $stmt1);
>$stmt2="select * from vserv0;";
>$sth = ibase_query ($dbh, $stmt2);
>?>
>
>It should create a view vserv0 and make a selection
>(select * from ...}. For some reason it process always
>just the first query (create). The second one gives me
>a message "table vserv0 doesn't exist". When I create
>view vserv0 manualy (IB console) it works without any
>problems.
>please help.
>
>Thanks Stephano
>
>
>_
>http://invites.yahoo.com.au - Yahoo! Invites
>- Organise your Mardi Gras party online!
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]