Re: RE: RE: [PHP-DB] Query construction

2001-09-19 Thread Russ Michell

I'm sorry but I must be missing something fundamental here. This is how my code looks, 
and if the 
SQL query yields nothing and emits no error (as it currently is) it simply reverts to 
error.php:

$sql = SELECT * FROM $table_users WHERE usrName='$username' AND 
usrPswd=password('$password') AND affil_team RLIKE '$team+';
$result = mysql_query($sql, $connection) or die(mysql_error());
$num = mysql_num_rows($result);
//User hasn't been found in DB with current details:
if ($num == 0) {
header(Location: error.php?err=n_player);
exit;
}
else {
while($row = mysql_fetch_array($result)) {
etc etc


Cheers again:
Russ

On Wed, 19 Sep 2001 09:26:07 -0500 Rick Emery [EMAIL PROTECTED] wrote:

 $query = SELECT * FROM $table_users WHERE usrName='$username' AND
 usrPswd=password('$password') AND affil_team RLIKE '$team+'
 print $query
 
 what were the contents of $query
 
 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 19, 2001 9:19 AM
 To: Rick Emery
 Cc: [EMAIL PROTECTED]
 Subject: Re: RE: [PHP-DB] Query construction
 
 
 If you mean did the pattern I'm trying to match: $team, contain what I
 though it should: 
 'footballSat' then yes it did. I also receieve no error message from
 MySQl
 
 The string in the table field I can view/alter in phpMyAdmin and I've tried
 matching $team in the 
 query to the string as: footballSatfootballSun (etc etc) and also as:
 footballSat footballSun (etc 
 etc)..
 
 Any ideas??
 Many thanks.
 
 Russ
 
 On Wed, 19 Sep 2001 09:12:36 -0500 Rick Emery [EMAIL PROTECTED] wrote:
 
  When you printed-out the string variable containing the SELECT statement,
  what did it look like?
  
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, September 19, 2001 9:01 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Query construction
  
  
  Hi there:
  
  Further to a previous submission (which can be ignored), I'd like the
  following query to 'search' a 
  table field of different team names (stored as a single string), but it
  does't seem to work!
  
  SELECT * FROM $table_users WHERE usrName='$username' AND
  usrPswd=password('$password') AND affil_team RLIKE '$team+';
  (I've also tried: RLIKE '$team?' )
  
  This should match the string found in the variable: '$team' with the some
 of
  contents (string) 
  found in 'affil_team'.
  
  For example my test has been, trying to find 'footballSat', so $team =
  'footballSat'. 'footballSat' 
  exists as part of the string in the 'affil_team' field but the above query
  refuses to find 
  'footballSat'!! (No error is received though)
  
  I'm using MySQL 3.22.32 + php4.0.3pl1
  
  Cheers
  Russ
  
  #---#
  
Believe nothing - consider everything   

Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge

e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
t: +44 (0)1223 363271 x 2331
  
www.theruss.com
  
  #---#
  
  
  -- 
  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]
  
  -- 
  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]
  
 
 #---#
   
   Believe nothing - consider everything 
   
   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge
   
   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam
   t: +44 (0)1223 363271 x 2331
 
   www.theruss.com
   
 #---#
 
 -- 
 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]
 

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
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]




RE: RE: RE: [PHP-DB] Query construction

2001-09-19 Thread Rick Emery

You've created $sql.  Good.  Print it...display it...show its contents...

Does it contain the TEXT that you expect?  Copy and paste it to the mysql
command line in mysql.


-Original Message-
From: Russ Michell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 9:33 AM
To: Rick Emery
Cc: [EMAIL PROTECTED]
Subject: Re: RE: RE: [PHP-DB] Query construction


I'm sorry but I must be missing something fundamental here. This is how my
code looks, and if the 
SQL query yields nothing and emits no error (as it currently is) it simply
reverts to error.php:

$sql = SELECT * FROM $table_users WHERE usrName='$username' AND
usrPswd=password('$password') AND affil_team RLIKE '$team+';
$result = mysql_query($sql, $connection) or die(mysql_error());
$num = mysql_num_rows($result);
//User hasn't been found in DB with current details:
if ($num == 0) {
header(Location: error.php?err=n_player);
exit;
}
else {
while($row = mysql_fetch_array($result)) {
etc etc


Cheers again:
Russ

On Wed, 19 Sep 2001 09:26:07 -0500 Rick Emery [EMAIL PROTECTED] wrote:

 $query = SELECT * FROM $table_users WHERE usrName='$username' AND
 usrPswd=password('$password') AND affil_team RLIKE '$team+'
 print $query
 
 what were the contents of $query
 
 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 19, 2001 9:19 AM
 To: Rick Emery
 Cc: [EMAIL PROTECTED]
 Subject: Re: RE: [PHP-DB] Query construction
 
 
 If you mean did the pattern I'm trying to match: $team, contain what I
 though it should: 
 'footballSat' then yes it did. I also receieve no error message from
 MySQl
 
 The string in the table field I can view/alter in phpMyAdmin and I've
tried
 matching $team in the 
 query to the string as: footballSatfootballSun (etc etc) and also as:
 footballSat footballSun (etc 
 etc)..
 
 Any ideas??
 Many thanks.
 
 Russ
 
 On Wed, 19 Sep 2001 09:12:36 -0500 Rick Emery [EMAIL PROTECTED] wrote:
 
  When you printed-out the string variable containing the SELECT
statement,
  what did it look like?
  
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, September 19, 2001 9:01 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Query construction
  
  
  Hi there:
  
  Further to a previous submission (which can be ignored), I'd like the
  following query to 'search' a 
  table field of different team names (stored as a single string), but it
  does't seem to work!
  
  SELECT * FROM $table_users WHERE usrName='$username' AND
  usrPswd=password('$password') AND affil_team RLIKE '$team+';
  (I've also tried: RLIKE '$team?' )
  
  This should match the string found in the variable: '$team' with the
some
 of
  contents (string) 
  found in 'affil_team'.
  
  For example my test has been, trying to find 'footballSat', so $team =
  'footballSat'. 'footballSat' 
  exists as part of the string in the 'affil_team' field but the above
query
  refuses to find 
  'footballSat'!! (No error is received though)
  
  I'm using MySQL 3.22.32 + php4.0.3pl1
  
  Cheers
  Russ
  
  #---#
  
Believe nothing - consider everything   

Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge

e: [EMAIL PROTECTED]
w: www.apu.ac.uk/webteam
t: +44 (0)1223 363271 x 2331
  
www.theruss.com
  
  #---#
  
  
  -- 
  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]
  
  -- 
  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]
  
 
 #---#
   
   Believe nothing - consider everything 
   
   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge
   
   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam
   t: +44 (0)1223 363271 x 2331
 
   www.theruss.com
   
 #---#
 
 -- 
 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]
 

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

Re: RE: RE: [PHP-DB] Query construction

2001-09-19 Thread Russ Michell

 Learning is NEVER a waste of time...
No, of course not, but having been on these lists for sometime, I get the feeling some 
people (as I 
would, and do) get pi**ed off if someone doesn't at least try first before asking 
questions..

 p.s.  Your father is a psychiatrist???  Now, there, I could use some help...
No he isn't he just thinks he is ;-)

Many thanks.
Russ

On Wed, 19 Sep 2001 10:01:07 -0500 Rick Emery [EMAIL PROTECTED] wrote:

 It wasn't a waste of time.  Now, the next time you have a similar problem
 with a mySQL query, you'll follow this procedure.
 
 Learning is NEVER a waste of time...
 
 p.s.  Your father is a psychiatrist???  Now, there, I could use some help...
 
 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 19, 2001 9:56 AM
 To: Rick Emery
 Cc: [EMAIL PROTECTED]
 Subject: Re: RE: [PHP-DB] Query construction
 
 
 Ok ok ok!! Thank you both for the pointers, they did of course yield the
 problem - as bloody always 
 it's something completely different! As my old-dad always says: Everything
 is about something 
 else (although this was always meant in a psychiatrist-patient
 relationship..)
 
 Thank you again both, and I apologise for seemingly wasting your time, but I
 do value people's 
 ideas and opinions, and hopefully others do of mine also.
 
 Regards:
 Russ Michell (APU Webteam)
 
 On Wed, 19 Sep 2001 09:41:47 -0500 Rick Emery [EMAIL PROTECTED] wrote:
 
  YES!!! Exactly
  
  Russ...do what Steve syas...
  
  -Original Message-
  From: Steve Cayford [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, September 19, 2001 9:32 AM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Query construction
  
  
  Usually what I do when I'm having this type of problem is put the whole 
  sql statement into a string variable then print the variable out just 
  before running the query so you know exactly what's being sent to mysql. 
  Then I log into mysql from the command line and enter the query manually 
  to see what sort of response or error message I get.
  
  -Steve
  
  On Wednesday, September 19, 2001, at 09:01  AM, Russ Michell wrote:
  
   Hi there:
  
   Further to a previous submission (which can be ignored), I'd like the 
   following query to 'search' a
   table field of different team names (stored as a single string), but it 
   does't seem to work!
  
   SELECT * FROM $table_users WHERE usrName='$username' AND 
   usrPswd=password('$password') AND affil_team RLIKE '$team+';
   (I've also tried: RLIKE '$team?' )
  
   This should match the string found in the variable: '$team' with the 
   some of contents (string)
   found in 'affil_team'.
  
   For example my test has been, trying to find 'footballSat', so $team = 
   'footballSat'. 'footballSat'
   exists as part of the string in the 'affil_team' field but the above 
   query refuses to find
   'footballSat'!! (No error is received though)
  
   I'm using MySQL 3.22.32 + php4.0.3pl1
  
   Cheers
   Russ
  
   #---#
 
 Believe nothing - consider everything 
  
 Russ Michell
 Anglia Polytechnic University Webteam
 Room 1C 'The Eastings' East Road, Cambridge
  
 e: [EMAIL PROTECTED]
 w: www.apu.ac.uk/webteam
 t: +44 (0)1223 363271 x 2331
  
 www.theruss.com
 
   #---#
  
  
   --
   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]
  
  
  -- 
  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]
 
 #---#
   
   Believe nothing - consider everything 
   
   Russ Michell
   Anglia Polytechnic University Webteam
   Room 1C 'The Eastings' East Road, Cambridge
   
   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam
   t: +44 (0)1223 363271 x 2331
 
   www.theruss.com
   
 #---#
 
 -- 
 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]
 

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  Room 1C 'The Eastings' East Road, Cambridge
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com


Re: RE: RE: [PHP-DB] Query construction

2001-08-21 Thread Russ Michell

Damn!!

That'll be it..

I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 
Then again I don't get an error message from your query..???

Perhaps it has to do with the query being embedded, that is *where* it's embedded:

$totalsql = SELECT category,COUNT(*) FROM $Tpostings GROUP BY category;
$totalresult = mysql_query($totalsql,$connect) or error(Sorry! I was unable to 
process the 
required SQL transaction.);
while($totalrow = mysql_fetch_array($totalresult)) {
$total = $totalrow['category'];
}

//Results in:
'some stuff' being echoed to the page..

So I tried:
$totalsql = SELECT category,COUNT(*) AS total FROM $Tpostings GROUP BY category;

//Resulted in '2' being echoed to the page (2 is the number of posts in the 'some 
stuff' category) 
but 2 is displayed as being the number of posts in *all* the categories which isn't 
the case...

What do you think? (It's my luchtime too and I'm gonna go get some...)
Cheers once agin for trying.

Russ

On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian [EMAIL PROTECTED] wrote:

 Russ,
 
 I recreated your table/data (it's lunchtime and I thought I'd take a look at
 this) - my query returned the rows as below:
 
 --
  category count (*) 
 Edit Delete  russ category   3  
 Edit Delete  some stuff  1  
 --
 
 I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 4.0.4pl1 (MySQL is
 3.23.36) - perhaps the problem lies with the versions?
 
 damian
 
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: 21 August 2001 12:46
  To: Lunny Damian
  Subject: Re: RE: [PHP-DB] Query construction
  
  
  Damian:
  
  Thanks for that but it doesn't do what I wanted though. It 
  actually returns the first item ('some 
  stuff') from the table, where I wanted the total number of 
  occurances of *each category* in the 
  table, thus indicating the number of posts for each category 
  in the 'posts' table.
  
  !
  
  Many thanks.
  Russ
  
  
  On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian 
  [EMAIL PROTECTED] wrote:
  
   Russ,
   
   This should work for you:
   
   -
   select category,count(*)
   from posts
   group by category;
   -
   
   All the best,
   
   damian
   
   
-Original Message-
From: Russ Michell [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2001 12:10
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Query construction


Hi there people:

I have a MySQL table consisting of category names among 
  other things. 
I would like to be able to construct a query that tells me 
the number of times a unique category 
name occurs in the table:

//Table 'posts' from command-line
mysql explain posts;

  +--+-+--+-+++
| Field| Type| Null | Key | Default| 
  Extra  |

  +--+-+--+-+++
| id   | tinyint(3)  |  | PRI | 0  | 
  auto_increment |
| category | varchar(25) |  | ||  
|
| user | varchar(12) |  | ||  
|
| dateFrom | date|  | | -00-00 |  
|
| dateTo   | date|  | | -00-00 |  
|
| title| varchar(25) |  | ||  
|
| body | text|  | | NULL   |  
|

  +--+-+--+-+++
7 rows in set (0.00 sec)

//Table 'posts' in phpMyAdmin tab
id category  userdateFromdateTo  title
body 
3  some stuffmaurice 2001-09-23  2001-11-05  
Maurcie's post   this is Maurice's test
4  russ category russmichell 2001-08-17  2001-08-27  Russ is 
theone   this is another test
9  russ category russmichell 2001-08-16  2001-08-19  Begon by 
Monday! This entry should dissapear
10 russ category russmichell 2001-08-16  2001-09-04  testing  
This is another test!

For example I would like to know how many posts there are in 
the category 'russ category' (Should 
tell me there are 3 and only 1 for 'some stuff' ...

Can anyone help me toward a nice SQL query that would to 
  this for me!?
Cheers all.

Russ

#---#

  Believe nothing - consider everything   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: RE: RE: RE: [PHP-DB] Query construction

2001-08-21 Thread Russ Michell

 I always love that feeling when you beat a problem that refuses to go away.
So do I - but I aint beaten it yet! :-(

I'm still getting '2' as being the number of posts in each category when '2' is 
actually only the 
number of posts in *one* of the categories...weird-huh?

Cheers.

Russ

On Tue, 21 Aug 2001 12:46:37 +0100 Lunny Damian [EMAIL PROTECTED] wrote:

 I always love that feeling when you beat a problem that refuses to go away.
 
 Enjoy your lunch!
 
 damian
 
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: 21 August 2001 13:23
  To: Lunny Damian
  Cc: [EMAIL PROTECTED]
  Subject: Re: RE: RE: [PHP-DB] Query construction
  
  
  Damn!!
  
  That'll be it..
  
  I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 
  Then again I don't get an error message from your query..???
  
  Perhaps it has to do with the query being embedded, that is 
  *where* it's embedded:
  
  $totalsql = SELECT category,COUNT(*) FROM $Tpostings GROUP 
  BY category;
  $totalresult = mysql_query($totalsql,$connect) or 
  error(Sorry! I was unable to process the 
  required SQL transaction.);
  while($totalrow = mysql_fetch_array($totalresult)) {
  $total = $totalrow['category'];
  }
  
  //Results in:
  'some stuff' being echoed to the page..
  
  So I tried:
  $totalsql = SELECT category,COUNT(*) AS total FROM 
  $Tpostings GROUP BY category;
  
  //Resulted in '2' being echoed to the page (2 is the number 
  of posts in the 'some stuff' category) 
  but 2 is displayed as being the number of posts in *all* the 
  categories which isn't the case...
  
  What do you think? (It's my luchtime too and I'm gonna go get some...)
  Cheers once agin for trying.
  
  Russ
  
  On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian 
  [EMAIL PROTECTED] wrote:
  
   Russ,
   
   I recreated your table/data (it's lunchtime and I thought 
  I'd take a look at
   this) - my query returned the rows as below:
   
   --
category count (*) 
   Edit Delete  russ category   3  
   Edit Delete  some stuff  1  
   --
   
   I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 
  4.0.4pl1 (MySQL is
   3.23.36) - perhaps the problem lies with the versions?
   
   damian
   
-Original Message-
From: Russ Michell [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2001 12:46
To: Lunny Damian
Subject: Re: RE: [PHP-DB] Query construction


Damian:

Thanks for that but it doesn't do what I wanted though. It 
actually returns the first item ('some 
stuff') from the table, where I wanted the total number of 
occurances of *each category* in the 

table, thus indicating the number of posts for each category 
in the 'posts' table.

!

Many thanks.
Russ


On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian 
[EMAIL PROTECTED] wrote:

 Russ,
 
 This should work for you:
 
 -
 select category,count(*)
 from posts
 group by category;
 -
 
 All the best,
 
 damian
 
 
  -Original Message-
  From: Russ Michell [mailto:[EMAIL PROTECTED]]
  Sent: 21 August 2001 12:10
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Query construction
  
  
  Hi there people:
  
  I have a MySQL table consisting of category names among 
other things. 
  I would like to be able to construct a query that tells me 
  the number of times a unique category 
  name occurs in the table:
  
  //Table 'posts' from command-line
  mysql explain posts;
  

  +--+-+--+-+++
  | Field| Type| Null | Key | Default| 
Extra  |
  

  +--+-+--+-+++
  | id   | tinyint(3)  |  | PRI | 0  | 
auto_increment |
  | category | varchar(25) |  | ||  
  |
  | user | varchar(12) |  | ||  
  |
  | dateFrom | date|  | | -00-00 |  
  |
  | dateTo   | date|  | | -00-00 |  
  |
  | title| varchar(25) |  | ||  
  |
  | body | text|  | | NULL   |  
  |
  

  +--+-+--+-+++
  7 rows in set (0.00 sec)
  
  //Table 'posts' in phpMyAdmin tab
  id category  userdateFromdateTo  title
  body 
  3  some stuffmaurice 2001-09-23  2001-11-05  
  Maurcie's post   this is Maurice's test
  4  russ category russmichell 2001-08-17  2001-08-27  Russ is 
  theone   this is another test
  9  russ category russmichell 2001-08-16  2001-08-19  Begon

Re: RE: RE: RE: [PHP-DB] Query construction

2001-08-21 Thread Alnisa Allgood

At 1:44 PM +0100 8/21/01, Russ Michell wrote:
   I always love that feeling when you beat a problem that refuses to go away.
So do I - but I aint beaten it yet! :-(

I'm still getting '2' as being the number of posts in each category 
when '2' is actually only the
number of posts in *one* of the categories...weird-huh?


Try

SELECT category, COUNT(category) AS cat_count FROM postings GROUP BY 
category ORDER BY category

I find using the specific field you want count, instead of the count 
all fields changes the count results on occasion.

Alnisa
-- 
   .
Alnisa  Allgood
Executive Director
Nonprofit Tech
(ph) 415.337.7412  (fx) 415.337.7927
(url)  http://www.nonprofit-techworld.org
(url)  http://www.nonprofit-tech.org
(url)  http://www.tech-library.org
   .
Nonprofit Tech E-Update
mailto:[EMAIL PROTECTED]
   .
applying technology to transform
   .

-- 
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]