Re: PEAR Problem

From: Gurudutt <guru(at)indvalley(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: PEAR Problem
Date: 2001-10-09 08:07:13
Message-ID: 9114697982.20011009133713@indvalley.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)$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(at)indvalley(dot)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

Browse pgsql-php by date

  From Date Subject
Next Message Zavier Sheran 2001-10-12 01:55:10 Nextval
Previous Message Dan Wilson 2001-10-09 04:04:24 Re: PEAR Problem