Three problems.
ORDER BY dogs.affix LIMIT 5
returns bottom 5 not top. It should beORDER BY dogs.affix DESC LIMIT 5
to get the top.affix
returns eithernull
or an emprty string and that’s why you are getting the first error. Define this field asint not null default 0
in your database.- $total is not initialized. Assign it to 0 before the loop
1
solved How to get top five calculations only to appear