Home > Archive > PostgreSQL SQL > March 2006 > Unable to connect To Database...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Unable to connect To Database...
manashi chakraborty

2006-03-21, 3:33 am


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','$pa
ss')";

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

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





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com