mysqli限制产生的结果超过限制

I'm using this to fetch results from database.

$from=$to; ////limit from
$to=$from+5; ////limit to
$search_query="SELECT * FROM `user_info_secondary` WHERE `city`='$query' LIMIT $from,$to"

When i set $to=0; the search yields exactly 5 results but when i set to $to=5,10,15.... its shows me 6 results why is that?

$from=$to;
$to=$from+5;
$search_query="SELECT * FROM `user_info_secondary` WHERE `city`='$query' LIMIT $from,$to";
$do_search=  mysqli_query($connection, $search_query);
$number_of_results= mysqli_num_rows($do_search);
while($number_of_results>0)
{
       $get_result_details= mysqli_fetch_array($do_search);
       $search_result_details= $get_result_details['username'];
       echo $search_result_details;
       --$number_of_results;
} 

As Barmar said, it's not from, to - its offset, count

offset of 5 means item # 4 is where it starts

[0, 1, 2, 3, 4] 

and count of 10 results in:

0, 1, 2, 3 [START HERE] -> 4, 5, 6, 7, 8, 9 //(because 0 is part of that count so 9 is last). 

aka 6 items

offset 0 means you start at item # 0 and count of 5 results in

[START HERE] -> 0, 1, 2, 3, 4

aka 5 items

Just do this to fix it:

$from = ##;  // Where ## is the number you choose
$to = ($from > 0) ? $from + 4 : $from + 5;