Thank for the reply.... I added the code you suggested and still did not work... When trying to pull data from the entered query by using $row_StyleRS['id'] i get an error saying that the variable cannot be found.
Can a function not return anything , but simply set a variable like ${$ConnName} or ${'row_' . $ConnName} to be referenced to in the future?
Here is the code for anyone else passing by.
function OpenConnection($ConnName, $DesiredQuery) {
$hostname_Conn = "localhost";
$database_Conn = "database";
$username_Conn = "user";
$password_Conn = "password";
$Conn = mysql_pconnect($hostname_Conn, $username_Conn, $password_Conn) or die(mysql_error());
mysql_select_db($database_Conn, $Conn);
${$ConnName} = mysql_query($DesiredQuery, $Conn) or die(mysql_error());
${"row_".$ConnName} = mysql_fetch_assoc(${$ConnName});
${"totalRows_".$ConnName} = mysql_num_rows(${$ConnName});
};
If we assume that $ConnName = StylesRS
I need:
${$ConnName}->$StylesRS
${"row" . $ConnName}->$row_StylesRS
${"totalRows" . $ConnName}->$totalRows_$StyleRS
Can it be done?