pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: manashi chakraborty <manashi_130582@rediffmail.com>
To: pgsql-sql@postgresql.org
Subject: Unable to connect To Database...
Date: 21 Mar 2006 06:22:36 -0000
Message-ID: <20060321062236.12420.qmail@webmail45.rediffmail.com> (raw)

  
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 posgres" 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 the code or sum other problem
    waiting for the reply... 

Message-ID: <20060321062236.12420.qmail@webmail45.rediffmail.com>
Permalink:  ../20060321062236.12420.qmail@webmail45.rediffmail.com/
Also on:    postgresql.org/message-id/20060321062236.12420.qmail@webmail45.rediffmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: manashi_130582@rediffmail.com
  Subject: Re: Unable to connect To Database...
  In-Reply-To: <20060321062236.12420.qmail@webmail45.rediffmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox