X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 074B79DC9FD for ; Tue, 21 Mar 2006 19:39:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93380-05 for ; Tue, 21 Mar 2006 19:39:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ALPHA6.ITS.MONASH.EDU.AU (alpha6.its.monash.edu.au [130.194.1.25]) by postgresql.org (Postfix) with ESMTP id 288919DC8AE for ; Tue, 21 Mar 2006 19:38:59 -0400 (AST) Received: from curly.its.monash.edu.au ([130.194.13.87]) by vaxc.its.monash.edu.au (PMDF V6.1 #31276) with ESMTP id <01M0CPA1GRIE8Y5A55@vaxc.its.monash.edu.au> for pgsql-php@postgresql.org; Wed, 22 Mar 2006 10:38:14 +1100 Received: from curly.its.monash.edu.au (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 78A5AAB545 for ; Wed, 22 Mar 2006 10:38:13 +1100 (EST) Received: from [130.194.194.173] (cl-13d-526-c1.med.monash.edu.au [130.194.194.173]) by curly.its.monash.edu.au (Postfix) with ESMTP id 5A8E64FB0A for ; Wed, 22 Mar 2006 10:38:13 +1100 (EST) Date: Wed, 22 Mar 2006 10:38:20 +1100 From: Noel Faux Subject: [Fwd: Re: unable to connect to datadase....] To: pgsql-php@postgresql.org Message-id: <44208E6C.5090206@med.monash.edu.au> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_uYQMXUiHijE1TFMb+quZVw)" User-Agent: Thunderbird 1.5 (Windows/20051201) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.157 required=5 tests=[AWL=0.156, HTML_MESSAGE=0.001] X-Spam-Score: 0.157 X-Spam-Level: X-Archive-Number: 200603/11 X-Sequence-Number: 3461 This is a multi-part message in MIME format. --Boundary_(ID_uYQMXUiHijE1TFMb+quZVw) Content-type: multipart/alternative; boundary="Boundary_(ID_msvGG6FizYYv5qsoQJVgnw)" --Boundary_(ID_msvGG6FizYYv5qsoQJVgnw) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT Make sure that the postmaster is running with the -i flag allowing tcp\ip connections I suggest you use pg_last_error() and pg_last_notice() to see detailed errors if any. Cheers Noel manashi chakraborty wrote: > > > hi... > I am doin my project in PHP with PostgreSQL as backend... > Both r very new to me.... > My OS is LINUX > I am trying to connect to the database bt its not getin connected... > By using > "su postgres" command > i hav created user "root" and database "sample" > By using > "psql -U root sample" command > i hav created table "login" and inserted 3 data's... > Now through code using PHP i am trying to insert the data but > connection is not getin established.. > the code to connect to the datadase is :- > > require_once "DB.php"; > $uname=$_POST['uname']; > $pass=$_POST['pass']; > > $username="root"; > $password=""; > $hostname="localhost"; > $dbname="sample"; > > $db=new DB; > $dsource=$db->factory("pgsql"); > > $dcon=pg_connect("dbname=sample user=manashi"); > > $sql="insert into login values('$uname','$pass')"; > > $rs=$dsource->pg_query($sql); > ?> > > is there anythin wrong with tthe code or sum other problem > waiting for the reply... > > > --Boundary_(ID_msvGG6FizYYv5qsoQJVgnw) Content-type: text/html; charset=ISO-8859-1 Content-transfer-encoding: 7BIT Make sure that the postmaster is running with the -i flag allowing tcp\ip connections

I suggest you use pg_last_error() and pg_last_notice() to see detailed errors if any.

Cheers
Noel

manashi chakraborty wrote:

 
hi...
    I am doin my project in PHP with PostgreSQL as backend...
        Both r very new to me....
My OS is LINUX 
I am trying to connect to the database bt its not getin connected...
  By using
    "su postgres" command
  i hav created user "root" and database "sample"
    By using
    "psql -U root sample" command
      i hav created table "login" and inserted 3 data's...
  Now through code using PHP i am trying to insert the data but  connection is not getin established.. 
  the code to connect to the datadase is :-
 
<?php
  require_once "DB.php";
  $uname=$_POST['uname'];
  $pass=$_POST['pass'];

$username="root";
$password="";
$hostname="localhost";
$dbname="sample";

$db=new DB;
$dsource=$db->factory("pgsql");

$dcon=pg_connect("dbname=sample user=manashi");

$sql="insert into login values('$uname','$pass')";

$rs=$dsource->pg_query($sql);
?>

  is there anythin wrong with tthe code or sum other problem
    waiting for the reply...




--Boundary_(ID_msvGG6FizYYv5qsoQJVgnw)-- --Boundary_(ID_uYQMXUiHijE1TFMb+quZVw) Content-type: text/x-vcard; charset=utf-8; name=noel.faux.vcf Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=noel.faux.vcf begin:vcard fn:Noel Faux n:Faux;Noel org:Monash University;Biochemistry and Molecular Biology adr:;;;Clayton;Vic;3800;Australia email;internet:noel.faux@med.monash.edu.au tel;work:+61 03 9905 1418 url:http://vbc.med.monash.edu.au/~fauxn version:2.1 end:vcard --Boundary_(ID_uYQMXUiHijE1TFMb+quZVw)--