Trying to create a category and subcategory from a tutorial

Hello,
I found a tutorial on how to create a category and sub category but I cant seem to figure out how to display the mysql query results in the format they have in the tutorial.
this is the website: sqllessons.com/categories.html

tried different variation with foreach loop with no success… any ideas how to do this?

mysql query:


select root.name  as root_name
     , down1.name as down1_name
     , down2.name as down2_name
     , down3.name as down3_name
  from categories as root
left outer
  join categories as down1
    on down1.parentid = root.id
left outer
  join categories as down2
    on down2.parentid = down1.id
left outer
  join categories as down3
    on down3.parentid = down2.id
 where root.parentid is null
order
    by root_name
     , down1_name
     , down2_name
     , down3_name

what language are you using, php?

because we should really move this thread to the appropriate forum

by the way, that’s my article :smiley:

ic.

Im using PHP and trying to create a classified style script and your tutorial seem to fit what I’m looking for at the same time you made the breadcrumb sound easy so im trying to figure out, first, how to create the category and thesubcategory from the mysql results and sec… how to create the breadcrumb…

I’m not that good with php and tried different variations with foreach loop but something is’t working out.

good article easy to read…

any example floating round your compuetr you could share?

r

nope, sorry, i don’t do php

Yes indeed - this thread is moved to the PHP forum.