PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Already connected to the database

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures
View previous topic :: View next topic  
Author Message
sutterp



Joined: 16 Apr 2008
Posts: 6
Location: Western Australia

PostPosted: Sun Apr 20, 2008 4:07 am    Post subject: Already connected to the database Reply with quote

I need to do some pre-processing in my program. This pre-processing connects to the database via an include file and returns the MySQL link identifier as a global variable.

Code:
$dbConnect = mysql_connect($dbserver,...)


As I am already connected to the database when invoking datagrid->bind. What do I need to specify as the $options argument to re-use this connection? Specifying the MySQL link identifier results in:
Code:
Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/share/php5/PEAR/Structures/DataGrid.php on line 1466
 Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/share/php5/PEAR/Structures/DataGrid/DataSource.php on line 155
No Database object or dsn string specified
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1011

PostPosted: Sun Apr 20, 2008 10:33 am    Post subject: Reply with quote

Reusing such native database connections isn't possible in Structures_DataGrid. This would require that we have special code for every of the databases that PHP supports.

You didn't write it, but it seems that you want to use a SQL query in the bind() call. This works only in conjunction with PDO (not available on PHP 4) or the PEAR packages DB (deprecated) and MDB2. For MDB2 you'll find some details here:
http://pear.php.net/manual/en/package.structures.structures-datagrid.structures-datagrid-datasource.mdb2.php

If you have further questions on this, don't hesitate to ask.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software