Re: Multiple SQL queries...?

From: Date: Thu, 03 Jun 2004 15:50:12 +0000
Subject: Re: Multiple SQL queries...?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-34640@lists.php.net to get a copy of this message
Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) "Daniel Clark" <dclark@nwlink.com> 03/06/2004 16:49 Please respond to dclark@nwlink.com To Tristan.Pretty@risk.sungard.com cc "Daniel Clark" <dclark@nwlink.com>, "php-db@lists.php.net" <php-db@lists.php.net> Subject Re: [PHP-DB] Multiple SQL queries...? OK, how about this? $sql = "SELECT DISTINCT(email) FROM $table"; $result = mysql_query($sql,$connection) or die("Couldn't execute query 0."); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = "SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'"; $result1 = mysql_query($sql1,$connection) or die("Couldn't execute query 1."); echo ' ' . mysql_num_rows($result1) ; } echo $row1 ; > Kinda, but I just wanna count how many views in total... > Hence my $row1++; bit... > I'll have a play with your code though...! > Cheers, > Tris... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#34640) next »