need help with loop
Posted: Fri Nov 13, 2009 9:25 am
Need help with the below loop. I'm trying to optimize below with while / for loop:
so i tried putting it inside
but it's returning the array. I need to return the value one by one:
$gt11 = '0';
$gt12 = '0';
$gt13 = '1';
$gt14 = '0';
$gt15 = '1';
$gt16 = '0';
any help would be appreciated.
Code: Select all
$t11="SELECT count(r1) from table WHERE r1 = '1'";
$t12="SELECT count(r1) from table WHERE r1 = '2'";
$t13="SELECT count(r1) from table f WHERE r1 = '3'";
$t14="SELECT count(r1) from table WHERE r1 = '4'";
$$t15="SELECT count(r1) from table WHERE r1 = '5'";
$t16="SELECT count(r1) from table WHERE r1 = '6'";
Code: Select all
$i = 0;
while ($i <= 6)
{
$gt1[$i]="SELECT count(r1) FROM table WHERE r1 = '$i'";
}
$gt11 = '0';
$gt12 = '0';
$gt13 = '1';
$gt14 = '0';
$gt15 = '1';
$gt16 = '0';
any help would be appreciated.