HELP...Nested Looping issue
Posted: Thu May 03, 2007 5:36 pm
feyd | Please use
I believe the problem is the concantenation of the $Answers string as it just spits out one long string of all the answers...
The quesiton is? how do I break this up? so that it displays incrementally.
Thanks a million
Bryan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello All,
First time poster
I am having a looping issue that I cannot seem to find an answer to.
I have a db with two tables in it.
table 1: Questions
table 2: Question Responses
I would like to loop through these and pull back the following example:
Gender?
Male
Female
Favorite Color?
Red
Green
Blue
However what I am getting back is not exaclty correct:
Gender?
Male
Female
Red
Green
Blue
Favorite Color?
Male
Female
Red
Green
Blue
This is my nightmare in a nutshell:
I am trying to display the data in the following application =
http://www.gerd-tentler.de/tools/phpgraphs/example.php
as you can see it takes its data in a Coma seperated vlaue type arrangement.. I am doing this like suchCode: Select all
while ($Rows = mysql_fetch_array($NewQuestionsList))
{
$RelatedAnswers =& ReportsListingDAO::AnswerOptionsPerQuestion($Rows[SQID]);
$newGraphValues = $graphValues.$Rows[SQID];
$newGraphLabels = $graphLabels.$Rows[SQID];
while ($AnswerRows = mysql_fetch_array($RelatedAnswers))
{
$Answers .= $AnswerRows[Response_Text].',';
}
$NewAnswers = substr($Answers, 0, -1);
$newGraphLabels = $NewAnswers;
}The quesiton is? how do I break this up? so that it displays incrementally.
Thanks a million
Bryan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]