sql connection object issue php

if mysql connection already established do i need to pass connection object to constructor of schedulerConnector

$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass); mysql_select_db($mysql_db); $scheduler = new schedulerConnector($res);

website i m working on establish connection when user logged in so above code will make another connection when scheduler page loads i wont to avoid this cuz it will create 2 connections.

Hi,
if you somehow store persistent db connection between requests, you can pass the same connection to schedulerConnector constructor, creating individual connection for connector is not required.
Although, if you connect to db regular way, without using persistent connections, connections will be closed after php script finishes it’s work. So by the time schedulerConnector comes up, the connection that has been established when user logged in will be already closed.