Open Source Development Tutorials | Newsletter Signup | About Us
Search  

Go Back   Open Source Tutorials Forum > Programming Languages > PHP Development
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-06-2006, 10:32 PM
manashi_130582 manashi_130582 is offline
Junior Member
 
Join Date: Feb 2006
Posts: 5 manashi_130582 is on a distinguished road
Question PHP Fatal error: Call to undefined function: pg_connect()--unable to execute querie

hi...
i am working on PHP with POSTGRE SQL...
Operating System-Linux
When i am tryin to insert data...its not inserting data into the database....
i checked in system tools/system log/apache error logs
there its showing an error :-

[client 127.0.0.1] PHP Fatal error: Call to undefined function: pg_connect() in /var/www/html/examp/3.php on line 13, referer: http://localhost/examp/2.php


My php code for DB connection is as Follows :-

<?php
include("DB.php"); // present in /usr/share/pear
include("DB/pgsql.php"); // present in /usr/share/pear/DB
$uname = $_POST['uname'];
$pass = $_POST['pass'];

if($uname == "" || $pass == "")
{
echo "<p class=\"error\">No user name or password has been specified!";
return;
}
$dconn =pg_connect("host=localhost DATABASE=sample USER=root");
if(!$dconn)
{
return null;
}
else
return $dconn;

$sql="insert into login values('$uname','$pass');";
$result = pg_query($dconn,$sql);

if(!$result)
{
echo "<p class=\"error\">Error in insertin data</p>";
}
else
{
echo "<p>The data has been successfully inserted.";
echo "<meta http-equiv=\"refresh\" content=\"1; url=2.php\">";
}
pg_close($dconn);
?>


is there any problem with the code or sumthing else...
waiting for the reply...

Last edited by manashi_130582 : 03-16-2006 at 06:36 AM. Reason: No answer
Reply With Quote
  #2  
Old 03-18-2007, 03:54 AM
a.robert a.robert is offline
Junior Member
 
Join Date: Mar 2007
Posts: 2 a.robert is on a distinguished road
Default

hi,

you only need to install php-pgsql rpm and restart Apache.

Regards,
__________________
software reviews
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 07:15 AM.


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