have created a loop inside a loop inside a loop! but need to count the results from each loop, not the total loop;
total clients is straaight forward enough, but how can i count the result in relation to its parent?
ie.
client1 (
-project1
--file1
--file2
&total_files1=2
-project2
&total_files1=0
total_projects1=2)
$resultb = @("select * FROM jynk_projects GROUP BY client");
$c = 0;
$p = 0;
$f = 0;
while($row = @mysql_fetch_array($resultb)){
$client = $row['client'];
$id = $row['id'];
$updates_block .= "&id".$c."=$id&client".$c."=$client<br>";
$c++;
$sql2="select * FROM jynk_projects WHERE client=\"$client\" ORDER BY id";
$result2 = @mysql_query($sql2,$s)
or die("couldn't complete query.");
while ($row2 = @mysql_fetch_array($result2)) {
$title = $row2['title'];
$file_ref = $row2['file_ref'];
$updates_block .= "&title".$p."=$title&total_projects".$p."=<BR>";
$p++;
$sql3="select * FROM jynk_files WHERE project_ref=\"$file_ref\" ORDER BY id";
$result3 = @mysql_query($sql3,$s)
or die("couldn't complete query.");
while ($row3 = @mysql_fetch_array($result3)) {
$file = $row3['file'];
$updates_block .= "&file".$f."=$file&total_files".$f."=".$fb_total."<BR><BR>";
$f++;
}
}
}
echo "$updates_block&total_clients=$c";
prints this=
&id0=28&client0=B.Reynolds
&title0=b.card&total_projects0=
&file0=boats.jpg&total_files0=
&title1=website&total_projects1=
&file1=dune2.jpg&total_files1=
&id1=31&client1=dec0de
&title2=typeface&total_projects2=
&file2=tubelight.jpg&total_files2=
&title3=website&total_projects3=
&id2=35&client2=GTOR
&title4=web&total_projects4=
&file3=dune1.jpg&total_files3=
&id3=5&client3=ivillage
&title5=ivillage leaflets&total_projects5=
&file4=tubelight2.jpg&total_files4=
&id4=7&client4=MVOR
&title6=tall paul members area&total_projects6=
&file5=foodstall.jpg&total_files5=
&id5=37&client5=open
&title7=website&total_projects7=
&id6=6&client6=orange county 3
&title8=website&total_projects8=
&file6=cloud.jpg&total_files6=
&file7=tubetunnel.jpg&total_files7=
&title9=posters&total_projects9=
&file8=tunelight2.jpg&total_files8=
&title10=cd packaging&total_projects10=
&file9=spiralstairwell.jpg&total_files9=
&id7=2&client7=rich mix
&title11=RM_website&total_projects11=
&title12=RM_admin&total_projects12=
&file10=foodstall.jpg&total_files10=
&id8=34&client8=Sci-fi
&title13=logos&total_projects13=
&file11=palms.jpg&total_files11=
&id9=4&client9=smile
&title14=smile&total_projects14=
&file12=spirallights.jpg&total_files12=
&title15=HTML email&total_projects15=
&id10=27&client10=STA
&title16=A4 leaflet&total_projects16=
&id11=33&client11=suppotco
&title17=cd flyer&total_projects17=
&file13=sign.jpg&total_files13=
&id12=8&client12=triyoga
&title18=sched_02&total_projects18=
&title19=sched_03&total_projects19=
&file14=hostelroom.jpg&total_files14=
&title20=poster&total_projects20=
&total_clients=13