Thread: unable to connect to datadase....
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...
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/
----- Original Message -----From: manashi chakrabortySent: Tuesday, March 21, 2006 6:24 AMSubject: [PHP] unable to connect to datadase....
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...
unsubscribe
Announce wrote: > unsubscribe Is it that hard to go the place where you subscribed and click "unsubscribe" ? It's also in the email headers: List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-php> -- Postgresql & php tutorials http://www.designmagick.com/
unsubscribe Regards, -----Original Message----- From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org]On Behalf Of Announce Sent: Wednesday, March 22, 2006 6:33 AM To: pgsql-php@postgresql.org Subject: [PHP] unsubscribe unsubscribe ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings