Hướng dẫn php update url parameter

I've implemented pagination system for my website in php, only problem with that is following:
suppose my url at which pagination present is,www.abc.com/search.php?mode=study&query=a,currently its showing 20 results per page,when I use pagination to navigate across results, the url changes to www.abc.com/search.php?mode=study&query=a&page=2,www.abc.com/search.php?mode=study&query=a&page=2&page=3 and www.abc.com/search.php?mode=study&query=a&page=2&page=3&page=4,so the problem which I'm facing is when I navigate across results,every time page variable got appended to the url,which is really annoying.
My code for pagination is.

Chủ Đề