RE: [PHP-WIN] Re: Passing Variables
| From: | Opere, James | Date: | Fri, 24 May 2002 05:26:25 +0000 |
| Subject: | RE: [PHP-WIN] Re: Passing Variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-99070@lists.php.net to get a copy of this message | ||
I need the group by clause to enable me pick the count of each type of item
that can be used for drawing graphs.Remember that it is not very possible,
although i don't know yet to come up with a chart of different number counts
of each item without converting the counts to numerical values.
-----Original Message-----
From: Nicole Amashta [mailto:430ntr3k@bellsouth.net]
Sent: Friday, May 24, 2002 12:52 AM
To: php-windows@lists.php.net; php-general@lists.php.net
Subject: [PHP-WIN] Re: Passing Variables
Why do you need the group by clause? Do one or the other, not both.
either do a
select count(id) from table
or
select field, count(id) from table group by field
Check your query,
Nicole Amashta
www.aeontrek.com
James Opere wrote:
> Hi All,
> I'm trying to pass variables from one form to the other.I have a problem
> when i want to do the the following:
> 1.COUNT($variable)
> 2.DISTINCT($variable)
> .............
> I realise i can not use the brackets in my query and the variable be
> recognised.When i add COUNT without the brackets i still get an error.
> Example.
> test.html
> <form action="me.php" method="post">
> <input type="text" name="this">
> ..............
> This is sent to :
>
> me.php
> <?php
> $db=mysql_connect('localhost','','');
> mysql_select_db($database,$db);
> $sql="select COUNT($this) from $table group by $this";
> ................
> ?>
> This gives an error.
> Please help.
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php