I am not able to get my head around it.
I have this database table:
category_id
category_name
steps_description
Now I want to show in format like this
Catgeory 1
Then all steps under it
Catgory2
then all steps under it
Can I do it with one mysql query?
Please show me how to loop through with PHP.
EDIT:
I have got the data in object format i.e. collection of objects
I want the result like:
for all categories {
<table><tr><th>Catgory Name </th></tr>
<tr> <td>Step1 </td> </tr>
<tr> <td>Step2 </td> </tr>
<tr> <td>Step3 </td> </tr>
</table>
}
Something like that but with one query.
I’m not sure if I exactly know what you mean, but I will try anyway… .
I assume, you have many categoriy names within the table which aren’t unique. And you have many steps for each of them. Now you want to make a table for every category.
If this is right, you can try something like this: