Hi tomhath.
Thanks for helpful remarks. I guess your right, at least almost.
The file is a config file, witch is included() in all other "pages". The SESS_* is therefore also included in other files, but not as "global $variable;". I have read that using globals is not a good idea, because of security hazards. I try to avoid using globals in my script.
$SESS_DBHOST = 'localhost'; /* database server hostname */
$SESS_DBNAME = 'db_name'; /* database name */
$SESS_DBUSER = 'user'; /* database user */
$SESS_DBPASS = 'password'; /* database password */
$SESS_DBH = 'localhost';
function db_connect()
{
$result = @mysql_pconnect($SESS_DBHOST, $SESS_DBUSER, $SESS_DBPASS);
if (!$result)
return false;
if (!@mysql_select_db($SESS_DBNAME))
return false;
return $result;
}
My first thought was to write all the variables in the function name like, ... function db_connect($SESS_DBHOST, $SESS_DBUSER, $SESS_DBPASS, $SESS_DBNAME)... . If this is the case (is it??) my guess is that I have to do the same on every page there I call the function.
If this is the only way to solve it, it would be easier to write the host, db_name, username and password in the function instead of using variables.
I'm glad if you could comment my remarks. Thank you anyway for your last reply.
Kj.