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

2005-06-26 Thread Ross Honniball
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

[PHP-DB] MySQL/PHP how to put the results of one query in another query

2005-06-26 Thread Pedro Quaresma de Almeida
Hi I have two MySQL databases, on for aeromodelistas (aeromodelling) and another for Códigos Postais (Postal Codes). I whant to do the following query SELECT CódigoPostal FROM Aeromodelistas WHERE CódigoPostal IN (SELECT distinct(CP4) FROM codigopostal.LOCART,codigopostal.DISTRITO WHERE

Re: [PHP-DB] MySQL/PHP how to put the results of one query in another query

2005-06-26 Thread Ross Honniball
This is what I use when needing to do this: 1. Put all the values you want to search for in an array $vals (loop around the first result) 2. $query = select count(Nome) from Aeromodelistas where year(AnoQuota)=2005 and Sexo='Masculino' and Distrito IN .sqlIn($vals) ; function

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

2005-06-26 Thread Micah Stevens
If you don't want a group count, but want a total row count instead, there's no reason to have the group by statement, If you're trying to have a conglomerate result, where one column is always equal to the total count, wouldn't it be more efficient to have a seperate query for that? -Micah

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

Re: [PHP-DB] Re: list test subject. .

2005-06-26 Thread Martin Norland
[[[ O-F-F topic ]]] prefer replies offlist if they have to be done, but I had to clear the waters some on this. that said... JeRRy wrote: [A lot of mostly unintelligible and worthless to quote jumble] delays like this are not frequent, and should not be. delays like such. Most recently

[PHP-DB] MySQL Functions Installation

2005-06-26 Thread John Jairo Vega Angulo
Ok here's a dummy question from yet another newbie: Reading the instructions for enabling the MySQL Functions, I understood until i get to this: For compiling, simply use the --with-mysql[=DIR] configuration option where the optional [DIR] points to the MySQL installation directory. i have a

[PHP-DB] PostgreSQL error with php

2005-06-26 Thread Thomas Bonham
Hello All, I’m trying to get php to connect to my PostgreSQL database. The code that I’m using is below. htmlheadtitleLogin/title /head body ?php $conn = dbname=auth user=auth; $db = pg_connect ( $conn ); ? /body /html Warning: pg_connect(): Unable to

[PHP-DB] PostgreSQL error with PHP

2005-06-26 Thread Thomas Bonham
Hello All, I’m trying to get php to connect to my PostgreSQL database. The code that I’m using is below. htmlheadtitleLogin/title /head body ?php $conn = dbname=auth user=auth; $db = pg_connect ( $conn ); ? /body /html Warning: pg_connect(): Unable to

[PHP-DB] PostgreSQL error with PHP

2005-06-26 Thread Thomas Bonham
Hello All, I’m trying to get php to connect to my PostgreSQL database. The code that I’m using is below. htmlheadtitleLogin/title /head body ?php $conn = dbname=auth user=auth; $db = pg_connect ( $conn ); ? /body /html Warning: pg_connect(): Unable to connect

[PHP-DB] PostgreSQL with php error

2005-06-26 Thread Thomas Bonham
Hello All, I’m trying to get php to connect to my PostgreSQL database. The code that I’m using is below. htmlheadtitleLogin/title /head body ?php $conn = dbname=auth user=auth; $db = pg_connect ( $conn ); ? /body /html Warning: pg_connect(): Unable to

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

2005-06-26 Thread Ross Honniball
It worked! SELECT COUNT(*) FROM (SELECT COUNT(*) FROM ad.off_enrol GROUP BY jcu_campus, sub_code) t1 Thank you list -:) Martín Marqués wrote: 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

[PHP-DB] Re: PostgreSQL error with PHP

2005-06-26 Thread Thomas Bonham
I modafide the code some more and now with the following code I get this error. CODE: htmlheadtitleLogin/title /head body ?php pg_connect(name=auth); (user=auth); ? /body /html Parse error: parse error, unexpected '=' in

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

2005-06-26 Thread Robbert van Andel
The error is in your function pg_connect pg_connect(name=auth user=auth); I'm not a PostgreSQL user but your connection string should be enclosed into by quotes. Documentation can be found at http://us3.php.net/manual/en/function.pg-connect.php Hope this helps, Robbert -Original

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

2005-06-26 Thread Thomas Bonham
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);

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

2005-06-26 Thread Robbert van Andel
You might need to include the hostname and port. -Original Message- From: Thomas Bonham [mailto:[EMAIL PROTECTED] Sent: Sunday, June 26, 2005 6:48 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Re: PostgreSQL error with PHP Thanks for the help. The code now looks like this. CODE:

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

2005-06-26 Thread Thomas Bonham
I add the hostname and port, then I configure postgresql.conf and enable the port 5432 line in the config file. So this is the new code. htmlheadtitleLogin/title /head body ?php $conn = pg_connect( user=auth dbname=auth password=redhat

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

2005-06-26 Thread Thomas Bonham
I rewrote the code. This is the code and errors. This is starting to get old, I have been working on this for over a week now. CODE: htmlheadtitleLogin/title /head body ?php $conn = user=auth password=redhat dbname=auth host=localhost port=5432;

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

2005-06-26 Thread Robbert van Andel
Can you log into the PostgreSQL server from the console or command line? Are you sure you are using the right username, password or host? -Original Message- From: Thomas Bonham [mailto:[EMAIL PROTECTED] Sent: Sunday, June 26, 2005 8:03 PM To: php-db@lists.php.net Subject: Re: [PHP-DB]

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

2005-06-26 Thread Thomas Bonham
I think so. I'm going to go there my book (agin) and I'm also going to ask the head IT guy. Thanks for all of your help! Thomas Robbert van Andel wrote: Can you log into the PostgreSQL server from the console or command line? Are you sure you are using the right username, password or host?

Re: [PHP-DB] Re: list test subject. .

2005-06-26 Thread JeRRy
Just a quick reply. No I am not from NZ if you were asking me, which I don't think you were because my email states I am from Australia. Just thought I'd make that said. Thanks for your informative response. J Date: Sun, 26 Jun 2005 14:05:13 -0500From:Martin Norland [EMAIL