lundi 23 juillet 2018

Need some help creating content from database

Thank you so much for taking the time to help me out here, I am not great with php mysql so thought I'd ask the pros online ;)

I have a database that has the following entries:

Id / Name / Link / Main-Cat / Sub-Cat / Type / Clicks

So they are all links that need to be arranged by main category and then by subcategory in the following html structure.

<div class="sub-container">
    <div class="subtitle">Sub Title</div>
    <div class="grid-container">
      <div class="item">
          <div class="sub-subtitle"> Spec</div>
        <ul>
          <li> <a href="#">Link </a> </li>
          <li> <a href="#">Link </a> </li>
          <li> <a href="#">Link </a> </li>
          <li> <a href="#">Link </a> </li>
        </ul>
      </div>
    </div>
  </div>

Ideally, I'd like it to identify the Sub-Title once, then loop for all the sub-sub-categories underneath in the Item div and then list all links in that sub-sub category.

I've been playing around a bit but found nothing that would identify all main categories and then all subcategories all at once, I have manage to do it in individual requests but I realized that would require manual additions to the code if any extra main category or subcategory would be added and I'd like to avoid that.

I hope I explained properly what I tried to do, I'd be happy to help clarify any confusion.

Once more Thanks for taking the time to help me out.




Aucun commentaire:

Enregistrer un commentaire