Open Source Development Tutorials | Newsletter Signup | About Us
Search  

Go Back   Open Source Tutorials Forum > Databases > PostgreSQL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-21-2006, 01:14 AM
manashi_130582 manashi_130582 is offline
Junior Member
 
Join Date: Feb 2006
Posts: 5 manashi_130582 is on a distinguished road
Question Unable to connect To Database...PostgreSQL and PHP

hi...
I am doin my project in PHP with PostgreSQL as backend...
Both r very new to me....
My OS is LINUX
when I am trying to connect to the database but 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 in PHP i am trying to insert the data but data is not getin inserted
the code is as follows :-

<?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=root");

$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...
Reply With Quote
  #2  
Old 05-01-2006, 12:17 AM
pruthvi pruthvi is offline
Junior Member
 
Join Date: May 2006
Posts: 1 pruthvi is on a distinguished road
Default

hi,

this link might help you

http://us3.php.net/pgsql

regards

Pruthvi R
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 11:17 PM.


Powered by: vBulletin Version 3.0.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright 2004 - 2006 GrindingGears.com. All Rights Reserved.