"; // Selecting database mysql_select_db($database) or die('Could not select database'); print "Selected database successfully!
"; // Getting the input parameter (user): $user = $_REQUEST['user']; // Get the attributes of the user with the given username $query = 'SELECT email, fullname, gender, age FROM Users WHERE username = "'.$user.'"'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Can also check that there is only one tuple in the result $tuple = mysql_fetch_array($result, MYSQL_ASSOC) or die('User '.$user.' not found!'); print "User ".$user." has the following attributes:"; // Printing user attributes in HTML print ""; // Free result mysql_free_result($result); // Closing connection mysql_close($dbcon); ?>