Re: [PHP-DB] PHP5 + Postgres 8.0.0 + pg_transaction_status

2005-07-05 Thread Martín Marqués
El Mar 05 Jul 2005 06:33, Jo escribió:
 
 This sample code (as taken from de documentation):
 
$dbconn = pg_connect(dbname=x host=xxx.xxx.xxx.xxx user= 
 password=xxx) or die(Could not connect);
$stat = pg_transaction_status($dbconn);
if ($stat === PGSQL_TRANSACTION_UNKNOWN) {
   echo 'Connection is bad';
} else if ($stat === PGSQL_TRANSACTION_IDLE) {
   echo 'Connection is currently idle';
} else {
   echo 'Connection is in a transaction state';
}
 
 produces the following error:
 
 Fatal error: Call to undefined function pg_transaction_status() in 
 test.php on line 14

pg_connect seems to work, so I would guess (I haven't install PG8, nor PHP5 
yet) that something in the compiling didn't work properly. Maybe you should 
look for error detecting certain PG components, or see which version of libpq 
it found, and if it is the version on libpq that you installed with PG8.

You don't by the way have another version on PG installed?

 The php manual states the following:
 
   Not all functions are supported by all builds. It depends on your 
 libpq (The PostgreSQL C Client interface) version and how libpq is 
 compiled. If there is missing function, libpq does not support the 
 feature required for the function.

Yes, but you have the latest version of libpq (the one that comes with 
PostgreSQL 8.0.0). The only thing that can be happening is that PHP is 
finding another libpq in the way.

 I have installed Postgresql 8.0.0 from source and php 5.0.4 also from 
 source.

Update PostgreSQL to the latest 8.0.x version (lots of bugs were fixed since).


-- 
 09:33:15 up 2 days, 18:18,  1 user,  load average: 0.83, 0.70, 0.63
-
Lic. Martín Marqués   | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
 Universidad Nacional
  del Litoral
-

--
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 Martín Marqués
El Sáb 02 Jul 2005 14:21, John DeSoi escribió:
 
 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


I personally think he should start here:

http://pear.php.net/manual/en/package.database.db.php


-- 
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP-DB] show tables

2005-06-28 Thread Martín Marqués
El Mar 28 Jun 2005 10:43, blackwater dev escribió:
 How can I run a query to find all of the tables in a db with a certain
 columname?

On which database server?

-- 
 11:07:07 up 21 days, 22:53,  1 user,  load average: 2.58, 1.14, 0.84
-
Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
 Universidad Nacional
  del Litoral
-

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



Re: [PHP-DB] Re: PostgreSQL error with PHP

2005-06-27 Thread Martín Marqués
El Dom 26 Jun 2005 22:48, Thomas Bonham escribió:
 Thanks for the help.
 The code now looks like this.
 CODE:
 
 htmlheadtitleLogin/title
 
 /head
 body
 ?php
   
   $conn = pg_connect(user=auth dbname=auth password=redhat)
   or die (Could not connect) ;
   echo Connectd Successfully;
   pg_close($conn);
   
 ?
 /body
 /html
 
 And now the error I get is the following.
 
 
 Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: 
 IDENT authentication failed for user auth in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 8
 Could not connect

Check your pg_hba.conf file. Looks like you have IDENT authentification, and 
auth is not a system user.

Read the PostgreSQL documentation about this.

-- 
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP-DB] PostgreSQL 7.2 - 8.0 replication issue

2005-06-27 Thread Martín Marqués
El Lun 27 Jun 2005 17:48, Mark Galbreath escribió:
 The solution was to make sure that ftp mode is in ASCII (type I) and then 
execute the following, assuming a dummy database, test, has been created as 
part of the installation, and the database dump resides 
at /usr/local/pgsql/temp:

The best thing, giving the case that he's using Linux, is to use scp.

-- 
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP-DB] PostgreSQL 7.2 - 8.0 replication issue

2005-06-27 Thread Martín Marqués
El Lun 27 Jun 2005 15:31, Mark Galbreath escribió:
 I have to upgrade a web app from PHP 4.3.11 with PostgreSQL 7.2 to PHP 5.0.4 
with PostgreSQL 8.0.3.
 
 Currently I have PHP4 (as Apache 2.54 mod on port 80) and PHP5 (default CGI 
mode on port 8181) running concurrently on my DEV box.  I installed 
PostgreSQL 8.0.3 on the DEV box as well.
 
 On the PostgreSQL 7.2 server, I did a pg_dumpall  db.out and ftp'd db.out 
to the PostgreSQL 8.0.3 (DEV) server.  When I attempt to pg_restore db.out, 
the PostgreSQL archiver aborts with the error: input file does not appear to 
be a valid archive

Never used pg_restore. I just do this:

$ psql -f db.out

Always worked for me.

-- 
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP-DB] Efficient way to count rows when using GROUP BY

2005-06-26 Thread Martín Marqués
El Dom 26 Jun 2005 07:39, Ross Honniball escribió:
 Hi All,
 
 I use 
 
 SELECT COUNT(*) FROM whatever WHERE whatever
 
 to determine how many rows a particular query will return (then use this 
count to assist with pagination).
 
 The problem is that this does not work if the query contains a GROUP BY 
statement as, of course,
 the query will return many rows each with a count by each grouping.
 
 Does anyone know an efficient way to determine the number of ROWS a query 
with a GROUP BY
 statement will return (without just executing the entire query with no LIMIT 
statement)?

You are not stating which database you are working with, but I would do this 
(don't know if it's efficient, but it'll work):

SELECT sum(count) FROM 
(SELECT COUNT(*) AS count FROM whatever WHERE whatever) t1;

Hope it helps.

-- 
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP-DB] GROUP BY with a string column

2001-11-28 Thread Martín Marqués

On Mié 28 Nov 2001 19:42, you wrote:
 Can the SUM keyword in SELECT be generalized to strings?

 A tipical use for the SUM keyword is:

 SELECT column1, SUM(column2)
 FROM table
 GROUP BY column1

 This works only if column2 contains numbers (and SUM is the mathematical
 sum).

 What about obtain the same behaviour, when column2 contains strings (and
 SUM is string concatenation)?

With which database engine?

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]