Hi Everyone,
 
I'm trying to use MySQL to store some general settings for a site I am
working on, which I was then going to access as session variables on
pages as needed without having to call the dB each time.  However I am
having problems setting the name of the session variable in a way that I
can reference it later.  The code I am trying to use is:
 
===============================================================
   session_start();
   $connection =
@mysql_connect("$MySQLHost","$MySQLUser","$MySQLPassword") or
die("Unable to connect to MySQL Host. ".mysql_error() );
   $db = @mysql_select_db($MySQLdB, $connection) or die("Unable to
connect to MySQL dB. ".mysql_error() );
   $query = "SELECT * FROM config WHERE status = 1";
   $result = @mysql_query($query,$connection) or die("Unable to execute
select query. ".mysql_error() );
   $num_rows = mysql_numrows($result);
 
   while ($row = mysql_fetch_array($result))
   {
   $config_$row[config_id] = $row[config_value];
   session_register(config_$row[config_id]);
   }
 
   mysql_free_result($result);
   mysql_close($connection);
===============================================================
 
Any pointers much appreciated.
 
Stephen


Reply via email to