<?

// connection information
$hostName "dbm2.itc.virginia.edu";
$userName "mst3k";
$password "secret";
$dbName "mst3k_Inventory";

// make connection to database 
mysql_connect($hostName$userName$password) or die("Unable to connect to host $hostName");

mysql_select_db($dbName) or die("Unable to select database $dbName");

// Select all the fields in all the records of the Employees table
$query =
        
"SELECT inventory.dateAcquired, inventory.comments,
                employees.firstName, employees.lastName, 
        computers.computerDescription
        FROM inventory, employees, computers
        WHERE ((employees.firstName LIKE '$firstName%')
              and (employees.lastName LIKE '$lastName%')
          and (inventory.employeeID = employees.employeeID)
                and (inventory.computerID = computers.computerID))
        ORDER BY employees.lastName, employees.firstName"
;

$result mysql_query($query);

// Determine the number of employees
$number mysql_numrows($result);

if (
$number == 0) {
   print 
"Sorry, there were no records matching those criteria";
} else {
   
// Print the employee names
   
for($i=0$i<$number$i++){
    
$firstName mysql_result($result,$i,"firstName");
    
$lastName mysql_result($result,$i"lastName");
    
$computerDescription mysql_result($result$i"computerDescription");
    
$dateAcquired mysql_result($result$i"dateAcquired");
    
$comments mysql_result($result$i"comments");
        print 
"$lastName, $firstName, $computerDescription, 
        $dateAcquired, $comments<br>"
;
   }
}

// Close the database connection
mysql_close();

?>

<p>
<a href="multiCondition.phps"><font color="red">View the source</font></a>