Re: PEAR Problem - Mailing list pgsql-php

From Gurudutt
Subject Re: PEAR Problem
Date
Msg-id 9114697982.20011009133713@indvalley.com
Whole thread Raw
In response to PEAR Problem  (Gurudutt <guru@indvalley.com>)
List pgsql-php
Hello Dan,

Thanks very much for the help. Ya I tried enclosing with the quotes on
that unfortunately it doesn't work, it gives error.

Here are source code for the files.

You can try creating a table names ACT_NetworkTab with 2 fields,
NetCode(Integer) and NetWorkName(Varchar)

This is the php code which is used to print the values

<?
   //include new pgsql pear db file ...
   require_once("pgsqlpear.php");

   //verify for database server ...
   if(!$db)
   {
          //error occured .. send him to Error page ...
          echo "Database conenction failed (Line : 18)";
          exit;
   }
   else
   {
          //Begin Transaction ..
          $Begin_Query = "BEGIN";
          $Begin_Result = $db->query($Begin_Query);

          //Auto Commit Query ..
          //$AutoCommit_Query = "SET autocommit=0";
          //$AutoCommit_Result = $db->query($AutoCommit_Query);

          $Query  = "SELECT \"NetCode\",\"NetWorkName\" FROM
          \"ACT_NetworkTab\"";
          $Result = $db->query($Query);
          if(DB::isError($Result))
          {
               //Do a Roll Back ....
               $RoleBack_Query = "ROLLBACK";
               $RoleBack_Result = $db->query($RoleBack_Query);
               echo "Query Failed (line 38)";
               exit;
          }
          else
          {
               while($Row = $Result->fetchrow())
               {
                     echo
                     "NetCode:",$Row[NetCode]."---NetName:".$Row[NetworkName];
                     echo "<br>";
               }
          } //end of if db success ....

          //Commit the operation here .....
          $Commit_Query = "COMMIT";
          $Commit_Result = $db->query($Commit_Query);

   } //end of if submit ...

?>

This is the pgsql.php include file for Database connectivity
<?

   $dbuser     = "postgres";
   $dbpassword = "postgres";
   $dbhost = "localhost";
   $dbname = "ACTBilling";

   require_once("DB.php");

   $db = DB::connect("pgsql://$dbuser:$dbpassword@$dbhost/$dbname");

   if(DB::isError($db))
   {
      $db = 0;
      echo $db->getMessage();
   }
   else
   {
     $db->setFetchMode(DB_FETCHMODE_ASSOC);
   }
?>

Please try and help me!!

--
Best regards,
 Gurudutt                          mailto:guru@indvalley.com

Life is not fair - get used to it.
Bill Gates




Tuesday, October 09, 2001, 9:34:24 AM, you wrote:

DW> This is caused by the fact that PostgreSQL is case insensitive.  In order
DW> for it to actually take the case into account, you need quote your field
DW> names and table names.

DW> So your query would then be: select "NetCode","NetworkName" from
DW> "NetworkTab";

DW> Then you would be able to access the fields with $dbRow[NetworkName].

DW> -Dan

DW> : Hi,
DW> :
DW> : It's me again. I have been ab


pgsql-php by date:

Previous
From: "Dan Wilson"
Date:
Subject: Re: PEAR Problem
Next
From: Zavier Sheran
Date:
Subject: Nextval