pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
unable to connect to datadase....
2+ messages / 2 participants
[nested] [flat]

* unable to connect to datadase....
@ 2006-03-21 06:24 manashi chakraborty <manashi_130582@rediffmail.com>
  2006-03-21 06:44 ` Re: unable to connect to datadase.... Chris <dmagick@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: manashi chakraborty @ 2006-03-21 06:24 UTC (permalink / raw)
  To: pgsql-php

  
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... 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: unable to connect to datadase....
  2006-03-21 06:24 unable to connect to datadase.... manashi chakraborty <manashi_130582@rediffmail.com>
@ 2006-03-21 06:44 ` Chris <dmagick@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Chris @ 2006-03-21 06:44 UTC (permalink / raw)
  To: manashi chakraborty <manashi_130582@rediffmail.com>; +Cc: pgsql-php

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");


Add this after the pg_connect line:

echo pg_last_error();

what does that say?

Also change your mail program to send TEXT emails.

-- 
Postgresql & php tutorials
http://www.designmagick.com/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-03-21 06:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-21 06:24 unable to connect to datadase.... manashi chakraborty <manashi_130582@rediffmail.com>
2006-03-21 06:44 ` Chris <dmagick@gmail.com>

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