Prev | Current Page 25 | Next

Larry Ullman

"Building a Web Site with Ajax: Visual QuickProject Guide"

??™;
}
} else {
echo ???

Please select a valid
department from the drop-down menu in order to view
its employees.

??™;
}
?>
??¦
report on any errors
The PHP script should let the user know if an error occurred. Complete the
two IF conditionals created in the previous steps.
1 The fi rst else clause will apply
if the database query didn??™t
return any results.
2 The second else clause will
apply if the PHP script did not
receive a valid department ID.
browsing employees 17
$dbc = @mysql_connect (???localhost??™, ???username??™,
???password??™);
if (!$dbc OR !mysql_select_db (???ajax??™)) {
echo ???

The site is currently
experiencing technical difficulties. We apologize for any
inconvenience.

??™;
exit();
}
?>
connect to the database
Create a new, blank PHP script that connects to the database. This script does
not require the basic HTML tags. (See extra bits on page 23.)
1 The script fi rst tries to connect to MySQL. The username and password
values must match an existing MySQL user. Change these values
in this code to match the appropriate user for your MySQL server.


Pages:
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37