|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
hi,
you only need to install php-pgsql rpm and restart Apache. Regards,
__________________
software reviews |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|