Bypassing Database connection


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


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

$gridConn = new GridConnector($res,"MySQL");

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

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");