i hav tried the followin code in the server where my application is installed :-
Quote:
<?php
include("DB.php");
$db = new DB;
echo "OBJECT : $db <br>";
$dsource = $db->factory("pgsql");
echo "Source : $dsource <br>";
$dconn = pg_connect("dbname=sample user=root");
echo "Connection : $dconn <br>";
if($db->isError($dconn))
{
$val1=$db->isError($dconn);
echo "val1<br>";
}
else
echo "EStablished";
$sql="insert into login values(3,'cc');";
$rs=pg_query($sql);
echo "$rs";
if($rs==DB_OK)
{
echo "Failed to insert";
echo pg_last_error($dbconn) ."<br />\n";
}
else
{
echo "insert Complete";
}
?>
|
there its working fine... but on my system it giveing
Quote:
OBJECT : Object id #1
Source : Object id #2
Connection :
Connection EStablished
insert Complete
|
But when i am checkin in the DB using "psql -U root sample"
the query used is :"select * from login;"
no data is inserted in the table..
i hav logged into postgres and then created a user root
by running the install script of my application i hav created the DB
Db name :- sample
Db user :- root
by using psql -U root sample
i entered into the DB and gave conmmand
Quote:
sample=#\connect sample root
and the result was
You are now connected to database "sample" as user "root".
|
even after that data in not getting inserted.. i dnt know how to find where the problem lies...
In server i found 2 files Psql.php and PhpPgAdmin are present in /var/www/html directory
but these two file r not present in my system...
Is this is the reason that my Code is failin to connect to DB...