Re: [PHP-DB] PostgreSQL query many escape characters?

2009-05-02 Thread John DeSoi


On May 1, 2009, at 3:59 PM, Carol Walter wrote:


It would be much easier to read and write like this:

$query = 'INSERT INTO tblPeople(fName,mName,lName, ivlweb,  
cnsweb)'
.  VALUES ($new_f_name_new, $new_m_name_new, $new_l_name_new,  
$new_ivl_web_peop, $new_cns_web_peop);;



First query: INSERT INTO tblPeople(fName,mName,lName,  
ivlweb, cnsweb) VALUES ('Frank', 'D', 'Oz', 't', 't');
Second query: INSERT INTO  
tblContactInformation(contactItem,contactType) VALUES ('f...@indiana.edu 
', '0010')

Can't execute 2nd query

Actually, neither query executes.



What is the exact error message you are seeing?




John DeSoi, Ph.D.





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread John DeSoi


On Jul 21, 2007, at 7:53 AM, aldnin wrote:

When I try to send this query (select 'lacarrière' as test;) to a  
UTF8 initialized pgsql-database (8.2.4) from PHP 5.2.3 I get this  
error:


ERROR:  invalid byte sequence for encoding UTF8: 0xe87265

I use pg_query for the query delivery.

Client Encoding is set to:
 client_encoding
-
 UTF8
(1 row)

pg_client_encoding() also deliveres me UTF8.



My guess is that your PHP is not setup to handle UTF8, and is really  
sending something else. UTF8 is the default client encoding because  
that is the encoding of the database. It does not mean that PHP has  
set the right one. Before running your test, try executing this: SET  
client_encoding TO LATIN1; and see if that fixes it.





John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] debugging pg_connect

2007-04-29 Thread John DeSoi
I suspect that PostgreSQL would log anything related to a network  
connection problem if the error logging level was set correctly.


If you don't see any of those perhaps it is a networking issue. You  
might need to try an ethernet capture tool like Wireshark or perhaps  
something like tcpflow.


John



On Apr 26, 2007, at 4:26 AM, [EMAIL PROTECTED] wrote:


Hello,

since we upgraded to the latest php and PostgreSQL - we started to  
get frequent pg_connect() errors. What is sure is that they are not  
caused by insufficient connections - PostgreSQL reports 100  
connections available and less than 10 used when the pg_connect fails.


pg_last_error() and the other error handling functions operate on  
connection. So they do not seem useful when pg_connect() fails.


In the PostgreSQL documentation I could find out how to log  
successful connections, but not how to login failed connections.


Could somebody advice me on possible ways to test?




John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PostgreSQL function call model for PHP

2006-05-17 Thread John DeSoi

A short article on using a class to call PostgreSQL functions:

http://pgedit.com/resource/php/pgfuncall

Comments and suggestions welcome!


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: [PHP] pg_fetch_object

2005-09-24 Thread John DeSoi

Hi Michael,

On Sep 23, 2005, at 10:44 PM, Michael Fuhr wrote:


Works here with PHP 5.0.4 and PostgreSQL 8.0.3:


Thanks for the example, it helped me figure out my dumb mistake. I  
copied code from another place using a PHP abstraction library. I was  
calling 'db_fetch_object' not 'pg_fetch_object'.


Thanks much,



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] pg_fetch_object

2005-09-23 Thread John DeSoi

I'm using PHP 5.0.4, PostgreSQL 8.0.2.

Docs say (http://www.php.net/manual/en/function.pg-fetch-object.php):

object pg_fetch_object ( resource result [, int row [, string  
class_name [, array params]]] )


pg_fetch_object() returns an object with properties that correspond  
to the fetched row's field names. It can optionally instantiate an  
object of a specific class, and pass parameters to that class's  
constructor.


I'm passing a class name string as the third parameter, but I only  
get back a stdClass object. I also added an array of params as the  
4th parameter to pass to the constructor, but it does not appear to  
be called.


Has anyone successfully used this to create a class other than stdClass?

Thanks,


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] pg_connect gets fatal error

2005-08-18 Thread John DeSoi


On Aug 14, 2005, at 2:16 PM, Jon Crump wrote:

I'm guessing you're right, but it's not clear how I could tell. The  
output from ?php phpinfo() ? doesn't really help much unless I  
know what to look for. On the one hand it says that DBX support is  
enabled and PostgreSQL is one of the supported databases, on the  
other, MySQL support is described explicitly, as is ODBC, but there  
is no similar section for the other supported DBs. If php wasn't  
compiled with postgres support, do I have to recompile it? how?  
Apologies if these questions are naive, but I am a rank tyro in  
these matters.


Look at the Configure Command in phpinfo(). It should have the flag  
--with-pgsql.


One of the easiest ways to get PHP/PostgreSQL going on the Mac is to  
use this installer:


http://www.entropy.ch/software/macosx/php/



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Postgre SQL query error with PHP

2005-07-02 Thread John DeSoi


On Jul 1, 2005, at 9:37 PM, Thomas Bonham wrote:


Error:
Connection to Data Base established
Warning: pg_query(): Query failed: ERROR: permission denied for
relation property in
/var/www/html/thomas/cis166ae/database/web_users/dan/newrow.php on
line 20

Warning: Wrong parameter count for pg_num_rows() in
/var/www/html/thomas/cis166ae/database/web_users/dan/newrow.php on
line 21

As it show above I can connect to the database but no query.
The part of the code that is error I Think is the following.
$query = pg_query (
SELECT * FROM property
);



The first error is telling you that you don't have permission to  
select from the property table. See the GRANT command and make sure  
you have the correct permissions to work with the table.


The warning needs to be fixed also. The pg_num_rows command only  
takes one parameter. You need to remove the $dbconn parameter.



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Postgre SQL query error with PHP

2005-07-02 Thread John DeSoi


On Jul 2, 2005, at 9:17 AM, Thomas Bonham wrote:


If you wouldn't mind look over this error to I would be very nice.
The error that I'm have now is the following. It is probely very
sample, but I'm still learning php so not for me it not.


There is an example here, that I think will help you.

http://www.php.net/manual/en/function.pg-fetch-row.php

And if that does not help try just printing out the entire array so  
you know what is there.


See the var_dump function:

http://us2.php.net/manual/en/function.var-dump.php




John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] looking pgEdit beta testers

2005-05-15 Thread John DeSoi
Hi,
The latest beta release of pgEdit 1.1 includes support for PHP. If you 
use PHP and PostgreSQL, I would be very interested in your comments and 
feedback.

Changes since pgEdit 1.0 are summarized here: 
http://pgedit.com/node/view/30

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php