[Question]PhP Page

03/20/2013 00:17 Prideness#1
Hello,

I am trying to make a php script to view staff members and if they are on- or offline. Now I've been starting a little and tried out a bit, but I'm getting stuck already. What I am trying to do is to let the php script select the Leave of a certain staff member and 'undertake' action when the Leave status is 1 ('cause this means that the staff member is online, right?)

Code:
<?

    $dbhost = $_ENV['LOCAL_DOMAIN'];
    $dbuser = 'dbuser';
    $dbpwd  = 'dbpassword';

    // connect to SQL server
    if (!$link = @mssql_connect("$dbhost","$dbuser","$dbpwd"))
        {
            print "Failed to connect to MSSQL server.";
        };

    // select database
    if (!@mssql_select_db("PS_UserData",$link))
        {
            print "Failed to select database.";
        };

    // check if staff member is online
    $result1  = @mssql_query("SELECT Leave FROM Users_Master WHERE UserID='STAFF-ACCOUNTNAME' IF Leave='1'",$link);
	$result2  = @mssql_query("SELECT Leave FROM Users_Master WHERE UserID='STAFF-ACCOUNTNAME' IF Leave='1'",$link);
	$result3  = @mssql_query("SELECT Leave FROM Users_Master WHERE UserID='STAFF-ACCOUNTNAME' IF Leave='1'",$link);
	$result4  = @mssql_query("SELECT Leave FROM Users_Master WHERE UserID='STAFF-ACCOUNTNAME' IF Leave='1'",$link);
	$result5  = @mssql_query("SELECT Leave FROM Users_Master WHERE UserID='STAFF-ACCOUNTNAME' IF Leave='1'",$link);
	$result6  = @mssql_query("SELECT Leave FROM Users_Master WHERE UserID='STAFF-ACCOUNTNAME' IF Leave='1'",$link);


?>
This is what I got until now, I don't know if I'm doing it right though ('cause I'm quite a big newbie to php scripting). Please correct me if I am wrong, I do not expect you to do it all('cause I want to learn it by myself too :P) but a hint would be appreciated. Could anyone help me a bit further (when I am right) or correct me when I'm wrong please? :D

Thanks in Advance :handsdown: