Well, why are you running your query before you tack on the "LIMIT" clause?
Also, I'm unclear as to why you set $kull = $query (a string), but then use $kull in a mathematical expression ($kull / $numrowsperpage). $num_pages will ALWAYS be zero because PHP will convert the query string to 0 when it's used in a mathematical context.
I don't want to sound extra harsh, but you really need to take a few minutes and read each line of your code to make sure it makes sense. The last three lines of your code block make absolutely no sense. Line by line, this is how your program reads in english:
if $u and $m and $i are all empty strings,
$start gets the value of the first row in this page.
$query gets the value of an SQL query selecting ALL rows and columns.
Run the query.
$kull is a copy of the original query string.
divide $kull (a string!) by $numrowsperpage, round up,
and assign value to $num_pages.
append LIMIT clause to $kull.
I know that learning a new language is difficult, but I cannot in good conscience just give you the corrected code. I'll leave it to you to figure out. If you're still having problems after giving it some serious thought, let us know and we'll see how we can guide you.