Multiple Grids in separate folders

QuestionsMultiple Grids in separate folders
Peter Allen asked 7 years ago

I would be using the phpgrid on one web site that may have several different sections displaying data from different tables and databases. Let's assume I have the registered version (but right now I have the free version right at the moment).

Here is how I was thinking of installing phpgrid:

Server root:
"www"

Phpgrid location:
"wwwphpgrid" <– Main phpgrid code here

Module #1 of my app:
"wwwappmodule1"

Module #2 of my app:
"wwwappmodule2"

In this case lets say then that I want two different grids with different tables.

What files would I have in each module (folder) I am pretty sureit would be at least the one PHP file with the phpgrid properties?
appmodule1
appmodule2

would I have a separate config.php in each folder that points to the phpgrid and indicate the different table/view for each grid?

Thank you so much for the help!

3 Answers
Abu Ghufran answered 7 years ago

What you will need is:

1) Place 'lib' folder and config.php in wwwphpgrid
2) In module1, create a grid php file e.g. grid1.php
2) In module2, create a grid php file e.g. grid2.php

In both files, you will include config.php and lib/inc/jqgrid_dist.php files, as http://www.phpgrid.org/demo/demos/editing/index.phps

And set different table config inside grid1.php and grid2.php

Hope it help.

peter mostmans answered 7 years ago

Abu. For reference right now phpgrid is in folder "phpgrid-org" on my local Apache server. The demo version works just fine. I used the file you indicated,, "index.php" and changed the following lines to match those of the griddemo for now. The password is the same although it doesn't show here.

include_once("../../phpgrid-org/config.php");
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");

// Database config file to be passed in phpgrid constructor
$db_conf = array(
"mysql" => PHPGRID_DBTYPE,
"localhost" => PHPGRID_DBHOST,
"DBUser" => PHPGRID_DBUSER,
"" => PHPGRID_DBPASS,
"griddemo" => PHPGRID_DBNAME
);

$g = new jqgrid($db_conf);

And again the remainder of index.php hasn't changed and I call this file "grid1.php" for now. I am getting the error:

ADONewConnection: Unable to load database driver ''

My location on my server for grid1.php is "/recipedirectory/catalog/grid1.php"

I can't seam to see an error, although, there must be one. What am I missing? Thank you!

Abu Ghufran answered 7 years ago

Correct $db_conf array will be like:

$db_conf = array();
$db_conf["type"] = "mysqli"; // mysql,oci8(for oracle),mssql,postgres,sybase
$db_conf["server"] = "localhost";
$db_conf["user"] = "DBUser";
$db_conf["password"] = "PASS";
$db_conf["database"] = "griddemo";

$grid = new jqgrid($db_conf);

Your Answer

0 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?