The following scenario has me confused. In my main program I have:-
<?php
$link = '';
.....snip......
?>
in an included function I have
<?php
function PMConnect() {
global $dbservertype, $servername, $dbusername, $dbpassword,
$dbname, $link;
$link = mssql_connect("$servername", "$dbusername", "$dbpassword");
if (!$link) {
sprintf($Message, "At %d in %s Could not connect to %s at %s as
%s",__LINE__, __FILE__, $dbname, $servername, $dbusername);
trigger_error(E_USER_ERROR, $Message);
}
if (!(mssql_select_db("$dbname", $link))) {
sprintf($Message, "At %d in %s Could not select %s at %s as
%s",__LINE__, __FILE__, $dbname, $servername, $dbusername);
trigger_error(E_USER_ERROR, $Message);
}
echo "In PMConnect() link = $link<br>";
}
?>
and here the echo shows that $link contains data but now in another
included function I have
<?php
function GetActive($Datum) {
global $link;
echo "In GetActive() link = $link<br>";
.....snip......
this echo shows that $link is empty.
NB. All my functions are contained within .inc files that are
incorporated via something similar to include('includes/PMConnect.inc');
What am I misunderstanding ?
--
Regards,
Alf Stockton www.stockton.co.za
Man is the only animal that blushes -- or needs to.
-- Mark Twain
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php