register_globals are the items that are passes through the browsers header. If off, you must use $POST, $GET, etc.

As far as your code, line 5 shows no errors.
Try modifying the following.

$db = mysql_connect($hostname,$mysql_login,$mysql_password);
if (!$db) { print("Can't connect to mysql." . mysql_error()); exit; } 

$tbls = mysql_select_db($database,$db);
if (!$tbls) { print("Can't connect to db."); exit; }

    Thanks for the reply.

    I made the changes you suggested and I still get a parse error on line 5.

    <? php
    // connect.php is the database connector

    // set connection variables
    $hostname = "studb.cms.gre.ac.uk";
    $database = "mdb_hp208";
    $mysql_login = "hp208";
    $mysql_password = "";

    $db = mysql_connect($hostname,$mysql_login,$mysql_password);
    if (!$db) { print("Can't connect to mysql." . mysql_error()); exit; }

    $tbls = mysql_select_db($database,$db);
    if (!$tbls) { print("Can't connect to db."); exit; }

    ?>

    Is there anything I should be looking for? Do you need to see any more of my code?

      Paste the accual Parce Error message. Copy-n-Paste it here

        These are your first 5 lines, try:

        <? php
        // connect.php is the database connector

        // set connection variables
        $hostname = "studb.cms.gre.ac.uk";

          Parse error: parse error in ./connect.php on line 5

            Frederick, I get the error on my authenticate.php page.

            It also gives the following error:

            Sql error : No Database Selected

            Here is the authenticate.php code:

            <?php
            error_reporting(2047); // 1 = suppress warning messages, 2047 = E_ALL all error messages
            session_start(); // initialise session
            header("Cache-control: private"); // allow the back button to function

            // convert username and password from POST or SESSION
            if($POST["username"])
            {
            $username=$
            POST["username"];
            $password=$POST["password"];

            }
            elseif($
            SESSION["username"])
            {
            $username=$SESSION["username"];
            $password=$
            SESSION["password"];
            }

            // start and register session variables
            session_register("username");
            session_register("password");

            // connect to database
            include("connect.php");

            include("banner.php");

            // $link = mysql_connect("studb.cms.gre.ac.uk", "hp208", "") or die("Cannot connect to DB!" . mysql_error());
            // @mysql_select_db("mdb_hp208") or die("Cannot select DB : " . mysql_error());
            // if(isset($POST["submit"])) {
            // $sql = "SELECT id, username FROM users WHERE username='" . mysql_real_escape_string($
            POST["username"]) . "' and pwd = '" . //mysql_real_escape_string($_POST["password"]) . "'";
            // $result = mysql_query($sql) or die("Sql error : " . mysql_error());

            // check username and password
            $sql = "select * from users where username='" . $username . "' and password='" . $password . "'";
            $result=mysql_query($sql) or die("Sql error : " . mysql_error());

            if(mysql_num_rows($result) == 0) {
            print "No such login in the system. Please try again.";
            session_destroy();
            exit();
            }
            else{
            print "Successfully logged into system.";
            //proceed to perform website’s functionality – e.g. present information to the user
            }
            ?>

              I see no issues. Can you attach your connect.php file so I can see if anything is getting cancelled out when you paste the code.

              Also try placing the include("connect.php"); to the top of the page and change include(); to require();

                I tried using require instead of include. i get the same error. here is connect.php

                <? php
                // connect.php is the database connector

                // set connection variables
                $hostname = "studb.cms.gre.ac.uk";
                $database = 'mdb_hp208';
                $mysql_login = 'hp208';
                $mysql_password = '';

                $db = mysql_connect($hostname,$mysql_login,$mysql_password);
                if (!$db) { print("Can't connect to mysql." . mysql_error()); exit; }

                $tbls = mysql_select_db($database,$db);
                if (!$tbls) { print("Can't connect to db."); exit; }

                ?>

                  Place the vbCodes for php around your pasted code so I can see it better.

                  [php vbCode]<?php
                  yourcode
                  ?>[/code]

                    I don't understand what you mean by [php vbCode]?

                      I've just tried to connect to the databse using connection code inside my authenticate.php file and it works!?!

                      How come it doesn't work if I include connect.php?

                      authenticate.php
                      <?php
                      // connect to database
                      //require("connect.php");
                      error_reporting(2047); // 1 = suppress warning messages, 2047 = E_ALL all error messages
                      session_start(); // initialise session
                      header("Cache-control: private"); // allow the back button to function

                      // convert username and password from POST or SESSION
                      if($POST["username"])
                      {
                      $username=$
                      POST["username"];
                      $password=$POST["password"];

                      }
                      elseif($
                      SESSION["username"])
                      {
                      $username=$SESSION["username"];
                      $password=$
                      SESSION["password"];
                      }

                      // start and register session variables
                      session_register("username");
                      session_register("password");

                      //authenticate.php - code taken from http://www.articlecity.com/articles/web_design_and_development/article_293.shtml and
                      //http://php.codenewbie.com/articles/php/1482/Login_With_Sessions-Page_1.html
                      include("banner.php");

                      $link = mysql_connect("studb.cms.gre.ac.uk", "hp208", "") or die("Cannot connect to DB!" . mysql_error());
                      @mysql_select_db("mdb_hp208") or die("Cannot select DB : " . mysql_error());
                      if(isset($POST["submit"])) {
                      $sql = "SELECT id, username FROM users WHERE username='" . mysql_real_escape_string($
                      POST["username"]) . "' and pwd = '" . mysql_real_escape_string($_POST["password"]) . "'";
                      $result = mysql_query($sql) or die("Sql error : " . mysql_error());

                      // check username and password
                      $sql = "select * from users where username='" . $username . "' and password='" . $password . "'";
                      $result=mysql_query($sql) or die("Sql error : " . mysql_error());

                      if(mysql_num_rows($result) == 0) {
                      print "No such login in the system. Please try again.";
                      session_destroy();
                      exit();
                      }
                      else{
                      print "Successfully logged into system.";
                      //$_SESSION["id"] = $userid; //set session variable to user's id
                      //proceed to perform website’s functionality – e.g. present information to the user
                      }
                      }
                      ?>

                        vbCode will colorize the code into its proper colors and if there are any inconsistent items, it will alter the colors from the error location. If all is coded correct, the colors will show correct.

                        Click the button in the replies area PHP and insert just a test to see where you place the vbCode.

                          <? php
                          // connect.php is the database connector
                          
                          // set connection variables
                          $hostname = "studb\.cms\.gre\.ac\.uk";
                          $database = 'mdb_hp208';
                          $mysql_login = 'hp208';
                          $mysql_password = '';
                          
                          $db = mysql_connect($hostname,$mysql_login,$mysql_passwo
                          rd);
                          if (!$db) { print("Can't connect to mysql." . mysql_error()); exit; }
                          
                          $tbls = mysql_select_db($database,$db);
                          if (!$tbls) { print("Can't connect to db."); exit; }
                          
                          ?>
                          

                            Here is the example of authenticate.php that works without using the require/include connect.php.

                            authenticate.php
                            <?php
                            // connect to database
                            //require("connect.php");
                            error_reporting(2047); // 1 = suppress warning messages, 2047 = E_ALL all error messages
                            session_start(); // initialise session
                            header("Cache-control: private"); // allow the back button to function
                            
                            // convert username and password from _POST or _SESSION
                            if($_POST["username"])
                            {
                            $username=$_POST["username"];
                            $password=$_POST["password"];
                            }
                            elseif($_SESSION["username"])
                            {
                            $username=$_SESSION["username"];
                            $password=$_SESSION["password"];
                            }
                            
                            // start and register session variables
                            session_register("username");
                            session_register("password");
                            
                            //authenticate.php - code taken from [url]http://www.articlecity.com/articles...ticle_293.shtml[/url] and
                            //http://php.codenewbie.com/articles/php/1482/Login_With_Sessions-Page_1.html
                            include("banner.php");
                            
                            $link = mysql_connect("studb.cms.gre.ac.uk", "hp208", "") or die("Cannot connect to DB!" . mysql_error());
                            @mysql_select_db("mdb_hp208") or die("Cannot select DB : " . mysql_error());
                            if(isset($_POST["submit"])) {
                            $sql = "SELECT id, username FROM users WHERE username='" . mysql_real_escape_string($_POST["username"]) . "' and pwd = '" . mysql_real_escape_string($_POST["password"]) . "'";
                            $result = mysql_query($sql) or die("Sql error : " . mysql_error());
                            
                            // check username and password
                            $sql = "select * from users where username='" . $username . "' and password='" . $password . "'";
                            $result=mysql_query($sql) or die("Sql error : " . mysql_error());
                            
                            if(mysql_num_rows($result) == 0) {
                            print "No such login in the system. Please try again.";
                            session_destroy();
                            exit();
                            }
                            else{
                            print "Successfully logged into system.";
                            //$_SESSION["id"] = $userid; //set session variable to user's id
                            //proceed to perform website’s functionality – e.g. present information to the user
                            }
                            }
                            ?>
                            

                              Here is an example of a typical connection page I use and your is not much different.

                              $DBServer = "localhost";
                              $DBUser = "username";
                              $DBPass = "password";
                              $DBName = "database_name";
                              $db = mysql_connect($DBServer,$DBUser,$DBPass) or die (mysql_error());
                              mysql_select_db($DBName,$db) or die (mysql_error());
                                Write a Reply...