46 lines
5 KiB
HTML
46 lines
5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>phpcompta: /home/dany/developpement/phpcompta-dev/phpcompta/html/p.php Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.4.4 -->
|
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
|
|
<div class="nav">
|
|
<a class="el" href="dir_000000.html">developpement</a> » <a class="el" href="dir_000001.html">phpcompta-dev</a> » <a class="el" href="dir_000002.html">phpcompta</a> » <a class="el" href="dir_000003.html">html</a></div>
|
|
<h1>p.php</h1><a href="p_8php.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <?php
|
|
<a name="l00008"></a><a class="code" href="p_8php.html#a4">00008</a> function <a class="code" href="p_8php.html#a4">db_connect</a>() {
|
|
<a name="l00009"></a>00009 $database_name = 'dossier1'; <span class="comment">// Set this to your Database Name</span>
|
|
<a name="l00010"></a>00010 $database_username = 'phpcompta'; <span class="comment">// Set this to your MySQL username</span>
|
|
<a name="l00011"></a>00011 $database_password = ''; <span class="comment">// Set this to your MySQL password</span>
|
|
<a name="l00012"></a>00012 <a class="code" href="export__ouv_8php.html#a8">$result</a> = pg_connect(<span class="stringliteral">"host=localhost dbname=dossier1 user=phpcompta"</span>);
|
|
<a name="l00013"></a>00013 <span class="keywordflow">if</span> (!$result) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
|
<a name="l00014"></a>00014 <span class="keywordflow">return</span> <a class="code" href="export__ouv_8php.html#a8">$result</a>;
|
|
<a name="l00015"></a>00015 }
|
|
<a name="l00016"></a><a class="code" href="p_8php.html#a0">00016</a> <a class="code" href="p_8php.html#a0">$conn</a> = <a class="code" href="p_8php.html#a4">db_connect</a>(); <span class="comment">// Connect to database</span>
|
|
<a name="l00017"></a>00017
|
|
<a name="l00018"></a>00018 <span class="keywordflow">if</span> ($conn) {
|
|
<a name="l00019"></a>00019 $zipcode = $_GET['param']; <span class="comment">// The parameter passed to us</span>
|
|
<a name="l00020"></a>00020 $query = <span class="stringliteral">"select * from zipcodes where zipcode = '$zipcode'"</span>;
|
|
<a name="l00021"></a>00021 <a class="code" href="export__ouv_8php.html#a8">$result</a> = pg_query($conn,$query);
|
|
<a name="l00022"></a><a class="code" href="p_8php.html#a1">00022</a> <a class="code" href="admin__repo_8php.html#a13">$count</a> = pg_numrows($result);
|
|
<a name="l00023"></a>00023 <span class="keywordflow">if</span> ($count > 0) {
|
|
<a name="l00024"></a>00024 <a class="code" href="cbc__be_8inc_8php.html#a0">$row</a>=pg_fetch_array($result,0);
|
|
<a name="l00025"></a><a class="code" href="p_8php.html#a2">00025</a> <a class="code" href="p_8php.html#a2">$city</a> = <a class="code" href="cbc__be_8inc_8php.html#a0">$row</a>['city'];
|
|
<a name="l00026"></a><a class="code" href="p_8php.html#a3">00026</a> <a class="code" href="p_8php.html#a3">$state</a> = <a class="code" href="cbc__be_8inc_8php.html#a0">$row</a>['state'];
|
|
<a name="l00027"></a>00027 }
|
|
<a name="l00028"></a>00028 }
|
|
<a name="l00029"></a>00029 <span class="keywordflow">if</span> (isset($city) && isset($state)) {
|
|
<a name="l00030"></a>00030 <span class="comment">// $return_value = $city . "," . $state; </span>
|
|
<a name="l00031"></a>00031 $return_value = '<?xml version=<span class="stringliteral">"1.0"</span> standalone=<span class="stringliteral">"yes"</span>?><zip><city>'.$city.'</city><state>'.$state.'</state></zip>';
|
|
<a name="l00032"></a>00032 }
|
|
<a name="l00033"></a>00033 <span class="keywordflow">else</span> {
|
|
<a name="l00034"></a>00034 $return_value = <span class="stringliteral">"invalid"</span>.<span class="stringliteral">","</span>.$_GET['param']; <span class="comment">// Include Zip for debugging purposes</span>
|
|
<a name="l00035"></a>00035 }
|
|
<a name="l00036"></a>00036 header('Content-Type: text/xml');
|
|
<a name="l00037"></a>00037 echo $return_value; <span class="comment">// This will become the response value for the XMLHttpRequest object</span>
|
|
<a name="l00038"></a>00038 ?>
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed May 31 21:39:15 2006 for phpcompta by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
|
|
</body>
|
|
</html>
|