I feel a real fool here as the mistake I'm making really must be very simple but I can see it though I do realize that it is scope related. I thought I understood global scope and local scope but obviously no.
I'm learning php and this a small project I've set myself to aid learning.
In index.php I do various checks on the site visitor and I include('ashley-functions.php'). Most seems to work fine and I am able to connect to the server ok. I then call function passwordCheck($user, $password) where should both a usename and password be present a database should be selected and connected to. The problem is that $conn is not a valid Mysql_link.
I need to know why the link has broken. I have set global $conn but this does not appear to be global within the functions.php
@$submitForm =$_SESSION['userType'] = $requestType;
if ($submitForm == 'registerRequest')
if ($submitForm == 'joinRequest')
// Connect to server
function serverConnect($mysqlHost, $mysqlUser, $mysqlPassword)
@$conn=mysql_connect($mysqlHost, $mysqlUser, $mysqlPassword);
echo "Connected to Server<br />";
echo "Connection to the server failed.<br />\n
// Select Database
function selectDb($db, $conn)
echo 'Sorry, We were Unable to Connect to the Database.';
else echo "Connected to Database";
function passwordCheck ($username, $password)
if (empty($username) OR empty($password))
echo '<br /><h3 align = "center">Please suppy all info</h3>';
// serverConnect($mysqlHost, $mysqlUser, $mysqlPassword);
Many thanks for the attention.
How do I set Experts-Exchange so that I am notified that a comments has been added.