Bypassing Database connection

Hello,

Reading the manual I seen that in the PHP file I must include something like this (if I understood it well):

require("microclassifieds/includes/grid_connector.php");

$res = mysql_connect("localhost",".....","......");
mysql_select_db("...........");

$gridConn = new GridConnector($res,"MySQL");
$grid->dynamic_loading([25,25]);
$grid->render_table("classifieds_items","id","logo,adtype,title,categoryid,newused,sellertype,starts,price,location");

While my script is not a standalone PHP script but rather an addon, with global active connection to database, how I can modify these commands to avoid asking for connection details from the end users?

By the way… That dynamic_loading has correct syntax???

Thank you
Christos

Just a follow-up. I tried:

$grid = new GridConnector();

hoping that without arguments it will use the active connection, but I got error messages. So this is not the solution.

Thank you

When establishing your first connection, store the resource in your session, then in the connector, use the session-variable.

Something like that:

Your File, which connects for the first time to your DB:... session_name("MY_SESSION_NAME"); session_start(); ... $_SESSION["DBConnection"] = mysql_connect("localhost",".....","......"); mysql_select_db("..........."); ...

Your Connector-Script: session_name("MY_SESSION_NAME"); session_start(); require("microclassifieds/includes/grid_connector.php"); $gridConn = new GridConnector($_SESSION["DBConnection"],"MySQL"); $grid->dynamic_loading([25,25]); $grid->render_table("classifieds_items","id","logo,adtype,title,categoryid,newused,sellertype,starts,price,location");