Hi, I am passing the results from my query into the mysql_fetch_row() function and then I want to put this into a normal array, so I can then manipulate the different records and bring them out in an order I require.
I have a two sections and a number of categories for each section. I want to be able to call out the first section and then a number of categories underneath it and then do the same with the second section.
For example:
section1
category1
category2
category3
section2
category4
caegory5
category6
So I have a query getting the two sections and a query to get all the categories and stored them.
I have used mysql_fetch_row to output the two sections but I am now stuck as to how I would get the categories I want in each section. I know i must need to use an array of some kind and use the index but Im just not experienced enough to know how to do this.
Here is my code:
/*Performing SQL query to get marking forms section and the section description for the specification marking form*/
$sectquery = "SELECT DISTINCT sectiontitle, description FROM section, marking_form_detail WHERE (marking_form_detail.sectionid = section.sectionid) AND (marking_form_detail.mformid =1)";
$result2 = mysql_query($sectquery) or die('Query failed: ' . mysql_error());
/*Performing SQL query to get marking form categories titles for the specification marking form*/
$catquery = "SELECT categoryid, categorytitle, markingtype FROM category, marking_form_detail WHERE (marking_form_detail.categoryid = category.categoryid) AND (marking_form_detail.mformid =1)";
$result3 = mysql_query($catquery) or die('Query failed: ' . mysql_error());
if(MySQL_num_rows($result2) > 0)
{
while($row = mysql_fetch_row($result2))
{
echo "<left>";
echo '<font size="4">';
echo '<b>'.$row[0].'</b>';
echo '</font>';
echo "<br>";
echo $row[1];
echo "<br>";
echo "</left>";
}
}
Can you help me please???
im really struggling