Sorry for my English. I have a mysql table like this
[ --------------------------]
[ parent_id ] [ category_id ]
[ --------------------------]
Site structured like this:
0
-> 1
-> 2
-> -> 3
-> -> -> 5
-> 4
and table will look like
0 1
0 2
2 3
0 4
3 5
How to write mysql while loop to input 5 and get list of it's parents until 0:
3
2
I know, how to write it in php, but I want to do only 1 query to database, but when I try to run "While" examples from official manuals, it returns a lot of errors.
You can achieve this with Procedures..
Every answers are incorrect, but I've done it. If somebody will need, try this.
Ok putting your answers together I created this one:
To access the procedure