Re: sql commnad in a for loop !

From: Date: Tue, 18 Jun 2002 19:40:06 +0000
Subject: Re: sql commnad in a for loop !
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-102767@lists.php.net to get a copy of this message
Uh, Mr Flesh: On Tue, Jun 18, 2002 at 05:54:21PM +0100, Septic Flesh wrote: > > for $day=1 until $day=31 > { > count how many records (rows) there are in the tracker table, > without counting rows that contain the same "user_id" value, > when the day=$day. > } What have you tried so far? Did you look at the Control Structures portion of the PHP manual on php.net yet? Also, your approach is overly complex. Use a GROUP BY statement in your query. Check out the MySQL (or whatever database you're using) manual for more info the on that. In this case, write something like "GROUP BY day, user_id" --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

« previous php.general (#102767) next »