query: " . $query . "
\n"); // $result = query($connection, $query); $total_rows = numrows($result); if($total_rows) { // create the table for the results print("\n"); for($row=0; $row < $total_rows; $row++) { $data = fetch_object($result, $row); print("\n"); // create a category header if($data->category != $samecategory) { if(isset($samecategory)) print("\n"); print("\n"); $rowshade = 0; $samecategory = $data->category; } // alternate bgcolors $shade = (($rowshade++ & 1) ? "dark" : "light"); // first line print("\n"); // second line print("\n"); // third line print("\n"); print("\n"); } print("
 
"); print($data->category . "
"); if($data->name && $data->contact) { print($data->name . " (" . $data->contact . ")"); } else { print($data->name . $data->contact); } print(""); print($data->phtyp1 . "  " . $data->phnum1); print("
"); print($data->address); print(""); print($data->phtyp2 . "  " . $data->phnum2); print("
"); print($data->city . ", " . $data->state . ". " . $data->zip); if($data->zipext) { print("-" . $data->zipext); } print(""); print($data->phtyp3 . "  " . $data->phnum3); print("
\n"); // release the database query result free_result($result); } else { print("

Empty Result

\n"); print("

The following query returned an empty result:

\n"); print("

" . $query . "\n"); } // close the database connection close($connection); } else { print("

Database Error

\n"); print("

Failed to connect to database: "); print($dbname . "

\n"); } // close up the html tags include("html/tail.std"); ?>