I am in need of a php sql query to a mysql database.
I need the shortest amount of code possible and it cannot involve triggers.
There are two tables. item_id and parent_id
Armed with only the final child item_id and its own parent_id, I must be able to trace its ancestry to the root parent_id which is 0.
In the image I am supplying with this job post, you will see the arrows trace the steps I would want to receive. In this example, if armed only with the knowledge the item_id='Motherboard Repair',
Your php query results should trace upwards and reveal a parent category structure of:
'0 \ Computer & Consumer Electronics \ Computers \ Computer Repair \ Motherboard Repair'
I am also attaching an sql export table in a zip file in case you wish to practice in advance.