A little off-topic... (sorry)
I am not sure that I like the practice the book is teaching you, by placing an @ symbol in front of the GET value.
I think it is better to test to see if it is set, and then, if it is, use the swich case...
Also, I think it is a good practice to quote array keys in the GET, POST, SESSION superglobals...
Lastly, I would not save my DB config info in a file with a .inc file extension. I would save it in a .php file and try and locate it ABOVE the root of the other files, for security. (But, that is another story, which you can find more about by searching the forums here...) But at lease change the file extension to PHP (making sure to use proper PHP syntax within it to avoid another parse error.
One last thing that is helpful is using the: mysql_error() function when
you are first starting out to see WHAT exactly the error is when trying to establish your connection to SQL, or selecting your db, or within your query statement, etc...
SO, I would suggest:
<?php
session_start();
include('database_info.php');
// if the value is set:
if(isset($_GET['do']))
{
// determine action:
switch($_GET['do']) {
case 'login':
$connection = mysql_connect($host, $user, $password) or die (mysql_error());
$db = mysql_select_db($database, $connection) or die (mysql_error());
$sql = "SELECT loginName
FROM newitstaff
WHERE loginName = '" . $_POST['fusername'] . "'
LIMIT 1";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result))
{
//echo 'you were found...';
}
else {
//echo 'you were NOT! found...';
}
break;
case 'logout':
// do something else
break;
} // .end switch
} // .end if "do" is set
?>