Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2006, 10:39 AM
Registered User
 
Join Date: Sep 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Do While loop within a Do While loop

I have what is probably a silly question, and I am probably attempting to approach this from the wrong angle from the start but...

I am using dreamweaver to create a forum, for which I have used Dreamweaver's built in server behaviours to repeat the a table with the forum topics on it. This appears to use a do while loop being drawn from a recordset that looks for the value '1' within a parentID column. I then have a separate recordset doing a Count of ID and grouping them by parentID.

What I am trying to do is to display the result of the count of ID within the repeated table currently I have attempted to use a do while loop (code bellow). Which repeatedly displays the result for the first.

<?php
     do {
           echo $row_recFMCount['CountOfintID'];
     } while ($row_recForum['intID'] == $recFMCount['intParentID'])
?>

I have played around with trying to include the count query within the first recordset.

Any help would be greatly received. I have listed the table that the data is being drawn from an the queries.

Simon

tblForum
---------
intID integer (autonumber)
intParentID integer
txtSubject VARCHAR(255)
txtBody TEXT
txtAuthor VARCHAR(50)
dteCreated DATETIME


Recordsets:
--------------
recForum

SELECT *
FROM tblForum
WHERE tblForum.intParentID = '1'

--------------
recFMCount

SELECT tblForum.intID AS CountOfintID, tblForum.intParentID
FROM tblForum
GROUP BY tblForum.intParentID
HAVING (((tblForum.intParentID)<>0))

---------------







Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with for-each loop athanatos XSLT 0 April 10th, 2006 07:20 PM
Do Until loop with IF crmpicco Classic ASP Databases 2 June 15th, 2005 05:35 PM
For....Loop kliu9 Excel VBA 5 February 10th, 2005 06:43 AM
Do Loop junemo Beginning PHP 8 July 28th, 2004 02:58 AM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.