$callDetailsSQL ="select calls.date as date, calls.time as time, ceil(calls.duration_incoming/60) as incoming_duration, ceil(calls.duration_outgoing/60) as outgoing_duration, calls.did as mobile, calls.cli as cli, calls.destination as destination, round(calls.rate_incoming+calls.rate_outgoing,2) as rate, round(calls.amount,2) as charge from calls, useraccounts, billingaccounts where calls.amount>0 and calls.did=useraccounts.mobile and useraccounts.billingid=billingaccounts.id and useraccounts.billingid='";
$callDetailsSQL .= $billingid."' and month(date)='";
$callDetailsSQL .= $Month."' and year(date)='";
$callDetailsSQL .= $Year."' order by calls.call_id desc";
using the above SQL, I generate a list of records, so how can I generate previous links and next links so that in each page I can only see a maximum of 20 records.