#18940 [NoF->Opn]: Unable to write to DB with PHP 4.2.2

From: Date: Wed, 09 Oct 2002 15:46:19 +0000
Subject: #18940 [NoF->Opn]: Unable to write to DB with PHP 4.2.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-21933@lists.php.net to get a copy of this message
ID: 18940 User updated by: marty@comitaustralia.com Reported By: marty@comitaustralia.com -Status: No Feedback +Status: Open Bug Type: PostgreSQL related Operating System: Redhat 7.2 PHP Version: 4.2.2 New Comment: I have just upgraded to apache 2 and php 4.2.3 and have the same problem. I can execute the following successfully: if (!($myFile=fopen("product.txt", "r"))) { exit; } while (!feof($myFile)) { $elements=fgetcsv($myFile,1024); if (!($elements[7]=='?')) { $Sql = "INSERT into tblproduct (productid,productdesc,package,lastsale,price,gst,deleted) VALUES ('$elements[0]','" . addslashes($elements[1]) ."','$elements[2]','$elements[7]','$elements[3]','$elements[14]','f')"; if(!($Sqlexec = pg_exec($db, $Sql))) print ($elements[0]); } } fclose ($myFile); where product.txt is a comma seperated text file. However, when I try to execute the following I get no response from the server: function search($id,$name) { $db = pg_connect("dbname=jpm user=postgres"); $cuid = strtoupper($id)."%"; If ($id != "") { $strSql="SELECT custId, name, street, suburb FROM tblCust WHERE custId like '$cuid'"; } else { $strSql="SELECT custId, name, street, suburb FROM tblCust where name like '$name%'"; } $result = pg_exec($db, $strSql); $numrows = pg_numrows($result); if ($numrows==0) { ?> <h2 align="center">No entries were found matching the search data.</h2> <center> <input type="button" value="New Search" onclick="location.href='cust_records.php'"> </center> <? } if (($numrows==1)) {// && ($name=="")) { $res = pg_fetch_array ($result,0); show(); ?> <script> parent.showdata('<? print"$res[custid]" ?>','<? print"$res[name]" ?>'); </script> <?} ......... Everything works perfectly when I use PHP verision 4.1.2 Can someone please help? Marty Previous Comments: ------------------------------------------------------------------------ [2002-09-21 01:54:56] sniper@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2002-08-16 10:20:42] kalowsky@php.net None that I know of, it works fine on my FreeBSD system. Can you attach a sample script for us to see what you're doing, and possibly a sample schema? Heck just have the PHP script make the schema, and perform the queries. ------------------------------------------------------------------------ [2002-08-16 10:16:07] marty@comitaustralia.com I have been using apache, php and postgresql for quite a while now. Recently I upgraded to the lates versions of all the components. Apache 1.3.26 PHP 4.2.2 Poistgresql 7.2.1 After the upgrade I found that I could read from the DB ie. select requests, but not write to the DB ie. insert, update. I get no error messages. I have tried everything including reinstalling apache, postgresql and php fresh, but have been unsuccessful. The only way I have been able to make everything work is to go back to PHP 4.1.2 and keep apache 1.3.26 and postgresql 7.2.1 Is there a bug in version 4.2.2 that prevents full control of postgresql?? Cheers, Marty ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18940&edit=1

« previous php.bugs (#21933) next »