I am new to OOP and have written a products class. All is working fine but I am unsure which of the below version of a method within this class is best?
The first gets the variables from within the object and the second passes the variables into the class. Both work. I originally had it as the first version but things seems to be running slow and then changed it to the second.
public function getProductURLstart(){
$select = "SELECT l.URL, p.id FROM logins AS l
INNER JOIN Pages AS p ON l.id = p.clientID
WHERE l.id = '$this->skID' AND p.productPage = 1";
$res = mssql_query($select);
$r = mssql_fetch_row($res);
$url = trim($r[0]);
$page_id = $r[1];
return $url .'/index.aspx?pageID='. $page_id . '&prodID=$this->prodID';
}
OR
static function getProductURLstart($skID, $prodId){
$select = "SELECT l.URL, p.id FROM logins AS l
INNER JOIN Pages AS p ON l.id = p.clientID
WHERE l.id = '$skID' AND p.productPage = 1";
$res = mssql_query($select);
$r = mssql_fetch_row($res);
$url = trim($r[0]);
$page_id = $r[1];
return $url .'/index.aspx?pageID='. $page_id . '&prodID=$prodId';
}