从分页中获取行的位置
all_ads.php
Page 1 2 3 4
Sl No. ID Ads Name Customer
----------------------------------
11 220 Test 1 Jennifer Lawrance
12 250 Test 2 Paul Walker
13 255 Test 3 Jennifer Lawrance
Sl No - PHP自动增量
ID - 来自MySql的行的唯一编号
MySql查询
SELECT ad.id, cust.full_name
FROM ads ad
INNER JOIN customer cust ON ad.customer_id=cust.id
WHERE ad.status='active'
ORDER BY ad.created_date ASC
LIMIT 20, 20
my_ads.php
登录后,需要在网站上显示客户广告位置的位置。 我试图获取特定字段的字号?
E.g: Sl no for Test 3 is 13
After Jennifer Lawrance Login
Sl No. ID Ads Name
------------------------
11 220 Test 1
13 255 Test 3
答案 0 :(得分:0)
试试这个。它为我工作。
if(empty($pageno) || $pageno == 1){
$srno = 1;
}
else{
$temp = $pageno-1;
$new_temp = $temp.'1';
$srno = (int)$new_temp;
}