Pagination Picture and Database record


i am busy with a php script which is suppose to show one record and one picture with a next and previous button but where my problem comes: It got a next arrow for the records and a separate next button for a picture like this (image)

Basically i want when you click the next button the picture and record should change.

Here is my coding: This is for the friends.php page