Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals

p.php

Go to the documentation of this file.
00001 <?php
00008 function db_connect() {
00009   $database_name = 'dossier1'; // Set this to your Database Name
00010   $database_username = 'phpcompta'; // Set this to your MySQL username
00011   $database_password = ''; // Set this to your MySQL password
00012   $result = pg_connect("host=localhost dbname=dossier1 user=phpcompta");
00013   if (!$result) return false;
00014   return $result;
00015 }
00016 $conn = db_connect(); // Connect to database
00017 
00018 if ($conn) {
00019   $zipcode = $_GET['param']; // The parameter passed to us
00020   $query = "select * from zipcodes where zipcode = '$zipcode'";
00021   $result = pg_query($conn,$query);
00022   $count = pg_numrows($result);
00023   if ($count > 0) {
00024     $row=pg_fetch_array($result,0);
00025     $city = $row['city'];
00026     $state = $row['state'];
00027   }
00028 }
00029 if (isset($city) && isset($state)) { 
00030   // $return_value = $city . "," . $state; 
00031   $return_value = '<?xml version="1.0" standalone="yes"?><zip><city>'.$city.'</city><state>'.$state.'</state></zip>';
00032 }
00033 else {  
00034   $return_value = "invalid".",".$_GET['param']; // Include Zip for debugging purposes
00035 }
00036 header('Content-Type: text/xml'); 
00037 echo $return_value; // This will become the response value for the XMLHttpRequest object
00038 ?>

Generated on Wed May 31 21:39:15 2006 for phpcompta by  doxygen 1.4.4