pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedresults from a opinion form
2+ messages / 2 participants
[nested] [flat]
* results from a opinion form
@ 2002-06-17 18:26 angelo.rigo@globo.com
2002-06-17 22:08 ` Re: results from a opinion form Keary Suska <hierophant@pcisys.net>
0 siblings, 1 reply; 2+ messages in thread
From: angelo.rigo@globo.com @ 2002-06-17 18:26 UTC (permalink / raw)
To: pgsql-php
Hi
I am working on a web form for, where i have 12 fields asking to enumerate
to 5 to 1 to avaliate the weigth that feature have to people choose my company.
I have choosed the data type to be a smallint on postgresql and a input
type text on html (php).
And still i have 5 fields to indicate wich media the people have contact
and helps or not wich i decide to be char on postgresql and input type checkbox
on php where true is 1.
How can i count take statistics and print in a php page from this form
i try the following:
SELECT count(metodo) FROM pesquisa where serie= 'a' || 'A' having '5'"
thios give me the error;
Warning: PostgreSQL query failed: ERROR: WHERE clause must return type bool,
not type unknown in /var/www/html/pesquisa/mnivela_teste.php on line 21
ERROR
________________________________________
A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: results from a opinion form
2002-06-17 18:26 results from a opinion form angelo.rigo@globo.com
@ 2002-06-17 22:08 ` Keary Suska <hierophant@pcisys.net>
0 siblings, 0 replies; 2+ messages in thread
From: Keary Suska @ 2002-06-17 22:08 UTC (permalink / raw)
To: pgsql-php
on 6/17/02 12:26 PM, angelo.rigo@globo.com purportedly said:
> I am working on a web form for, where i have 12 fields asking to enumerate
> to 5 to 1 to avaliate the weigth that feature have to people choose my
> company.
> I have choosed the data type to be a smallint on postgresql and a input
> type text on html (php).
>
> And still i have 5 fields to indicate wich media the people have contact
> and helps or not wich i decide to be char on postgresql and input type
> checkbox
> on php where true is 1.
>
> How can i count take statistics and print in a php page from this form
> i try the following:
> SELECT count(metodo) FROM pesquisa where serie= 'a' || 'A' having '5'"
>
> thios give me the error;
> Warning: PostgreSQL query failed: ERROR: WHERE clause must return type bool,
> not type unknown in /var/www/html/pesquisa/mnivela_teste.php on line 21
> ERROR
If you are using '||' as a logical OR, that is incorrect. || is the
concatenation operator in Postgres. You probably want serie = 'a' OR serie =
'A'. Your "having" clause is probably also incorrect, since it doesn't
reference anything.
Let's say that you have a table "votes" with question fields "field1",
"field2", etc., with corresponding value fields "value1", "value2", etc. If
you want to know how many of the rows in "votes" with "field1" = 'A' has a
value of 5, you would have the following SQL:
SELECT count( field1 ) FROM votes WHERE field1 = 'A' AND value1 = 5
If you want counts for all values for field1 (more efficient):
SELECT count( value1 ) FROM votes WHERE field1 = 'A'
GROUP BY value1 ORDER BY value1
Without your table schema, I can't recommend any further.
Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-06-17 22:08 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-17 18:26 results from a opinion form angelo.rigo@globo.com
2002-06-17 22:08 ` Keary Suska <hierophant@pcisys.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox