Prev | Current Page 81 | Next

Larry Ullman

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


3 The employee??™s name will be
formatted using a CSS class.
4 The employee??™s email address
will be linked so that clicking on
it begins an email to that person.
??¦
$r = mysql_query($q, $dbc);
if (mysql_num_rows($r) > 0) {
while ($row = mysql_fetch_array($r, MYSQL_NUM)) {
echo ???

$row[0]

Department: $row[2]

$row[1]

\n???;
} // End of WHILE loop.
?>
??¦
94 creating a search
report any errors
1 The fi rst else clause applies if the query ran
just fi ne but didn??™t return any results.
2 The MySQL connection is closed.
3 The second else clause applies if
the form was not properly fi lled out.
} // End of WHILE loop.
} else { // No employees.
echo ???

No employees were a
match.

??™;
}
mysql_close($dbc);
} else { // Invalid form data!
echo ???

Please enter at least a couple
of characters in the employee\??™s last name.

??™;
}
?>
??¦
creating a search 95
test the non-Ajax version
1 Load the HTML page in your
Web browser to test what we??™ve
created so far.


Pages:
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93