$zip_code = "12345";
$first_three_chars = substr($zip_code, 0, 3);
$zip_code_to_search = $first_three_chars . '%';
$query = "SELECT * FROM 99MC WHERE ZIP='$zip_code_to_search' ORDER BY LASTNAME"
//Connect to db first
.....
//run query
$result = mysql_query($query);
//Do rest of processing
.......
BT