Increasing on PHP writing

Users in the front after registration, there will be a list of users in the background, I think in this list to add a number, let him show how many members, as follows:

ID Name Gender
1 A female
2 B male
3 C female


As this number, if you write the code location of the PHP code

The list of users may have many pages, longhand will to page second and from 1 to start counting.?

This number is not ID, ID deletion would be less a, number is not small, so we need this function

Do not write, just learning PHP, time is long to know this question, hope you don't mind my

All the hard work to help write a

Started by Ignativs at October 25, 2016 - 3:32 AM

Posted my code, has marked number area



<?php for($a11=1,$a11==6,$a++){ ?>
<?php
require_once(dirname(__FILE__).'/../config.inc.php');
require_once(dirname(__FILE__).'/inc/common.php');
aPurview(302);
if(empty($do)) $do= '';
if($do=="sendmail"){
    header("Location: plus_mail.php?members=$members");
    exit;
}elseif($do=="setsite"){
    $site = intval($site);$id = intval($id);
    $db ->query("update {$cfg['tb_pre']}member set m_site=$site where m_id = $id");
    showmsg('The success of the operation!',"person_searchlist.php?segment=$segment&keyword=$keyword&operate=$operate&group=$group&page=$page");exit;
}elseif($do=="reload"){
    $rs = $db->get_one("select g_id,g_term,g_unit from {$cfg['tb_pre']}group where g_typeid=1 and g_isdefault=1 limit 0,1");
    if($rs){
        $groupid=$rs['g_id'];$term=$rs['g_term'];$unit=$rs['g_unit'];$startdate=dtime($fr_time,3);
        switch ($unit){
            case 'Day':$enddate=date('Y-m-d',strtotime($startdate."+$term day"));break;
            case 'Month':$enddate=date('Y-m-d',strtotime($startdate."+$term month"));break;
            case 'Season':$term=$term*3;$enddate=date('Y-m-d',strtotime($startdate."+$term month"));break;
            case 'Years':$enddate=date('Y-m-d',strtotime($startdate."+$term year"));break;
        }
    }else{
        showmsg('The configuration of the system fault, please contact the administrator!','-1');exit();
    }
    $db ->query("update {$cfg['tb_pre']}member set m_groupid=$groupid,m_enddate='$enddate' where DATEDIFF('".date('Y-m-d')."',m_enddate)>0 and m_typeid=1");
    showmsg("The success of the operation!","person_searchlist.php");exit;
}else{
	if($do!=''){
    $members=explode(',',$members);
    foreach($members as $k){
        if($do=="del"){
            //The integration interface code
            include_once(FR_ROOT.'/api/api_config.php');
            if(defined('UC_API')){
                if(FR_API=='uc'){list($uid,$username,$email)=uc_get_user($k);}else{extract(uc_user_get($k));}
                $ucresult = uc_user_delete($uid);
                echo $ucresult;
            }
            $db ->query("delete from {$cfg['tb_pre']}myexpert where m_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}myreceive where m_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}interview where i_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}recycle where r_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}myinterview where i_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}education where e_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}training where t_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}lang where l_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}work where w_pmember='$k'");
            $db ->query("delete from {$cfg['tb_pre']}letter where l_member='$k'");
            $db ->query("delete from {$cfg['tb_pre']}resume where r_member='$k'");
            //Delete LOGO
            $rs = $db->get_one("SELECT `m_id`,`m_logo` FROM `{$cfg['tb_pre']}member` WHERE `m_login`='$k' LIMIT 0,1");
            if($rs){
                $logo=$rs['m_logo'];
    		    if($logo!=''&&$logo!='error.gif') unlink(FR_ROOT.$logo);
            }
            //Delete image
            $query=$db->query("SELECT `p_filename` FROM `{$cfg['tb_pre']}picture` WHERE `p_member`='$k'");
            while($row=$db->fetch_array($query)){
                $filename=$row['p_filename'];
    		    if($filename!=''&&$filename!='error.gif') unlink(FR_ROOT.$filename);
            }
            $db ->query("delete from {$cfg['tb_pre']}picture where p_member='$k'");
            $db ->query("delete from {$cfg['tb_pre']}member where m_login='$k'");
        
        }elseif($do=="picture"){
        	$db ->query("update {$cfg['tb_pre']}member set m_logoflag=1 where m_login='$k'");
        }elseif($do=="unpicture"){
        	$db ->query("update {$cfg['tb_pre']}member set m_logoflag=0 where m_login='$k'");
        }elseif($do=="audit"){
			$db ->query("update {$cfg['tb_pre']}member set m_flag=1 where m_login='$k'");
			require_once(FR_ROOT.'/inc/mail.inc.php');
			$to=outinfo("{$cfg['tb_pre']}member",'m_login','m_email',''.$k.'','code');
            if($to!='Unknown'&&$regcArray[5]==1){
                $from='';
                $mailtemp=load_mailtemp('person_flag');
                $subject=replace_cfglabel($mailtemp['tit']);
                $subject=str_replace('{$The FR_ member name}',$k,$subject);
                $body=replace_cfglabel($mailtemp['con']);
                $body=str_replace('{$The FR_ member name}',$k,$body);
                sendmail($to, $from, $subject, $body);
            }
        }elseif($do=="unaudit"){
			$db ->query("update {$cfg['tb_pre']}member set m_flag=0 where m_login='$k'");
        }elseif($do=="comm"){
			$db ->query("update {$cfg['tb_pre']}member set m_comm=1 where m_login='$k'");
        }elseif($do=="uncomm"){
			$db ->query("update {$cfg['tb_pre']}member set m_comm=0 where m_login='$k'");
        }
    }
	showmsg("The success of the operation!","person_searchlist.php?segment=$segment&keyword=$keyword&operate=$operate&group=$group&page=$page");exit;
	}
}
$grouplist='';
$query=$db->query("select g_id,g_name from {$cfg['tb_pre']}group where g_typeid=1");
while($row=$db->fetch_array($query)){
	$grouplist.="<a href=\"?operate=$operate&group=$row[g_id]\">$row[g_name]</a> | ";
}
$rsdb=array();
$sqladd='';
if($keyword!=''){
	switch($segment){
		case "m_name":$sqladd.=" and m_name = '$keyword'";break;
		case "m_login":$sqladd.=" and m_login = '$keyword'";break;
		case "m_email":$sqladd.=" and m_email = '$keyword'";break;
		case "m_tel":$sqladd.=" and m_tel = '$keyword'";break;
		case "m_mob":$sqladd.=" and m_mobile = '$keyword'";break;
		default:$sqladd.=" and m_login = '$keyword'";
	}
}
if($operate!=''){
	switch($operate){
		case 0:$sqladd.=" and m_flag=0";break;
		case 1:$sqladd.=" and m_flag=1";break;
		case 2:$sqladd.=" and m_comm=1";break;
		case 3:$sqladd.=" and m_logoflag=0 and m_logo!=''";break;
		case 4:$sqladd.=" and DATEDIFF('".date('Y-m-d')."',m_enddate)>0";break;
		case 5:$sqladd.=" and DATEDIFF(m_enddate,'".date('Y-m-d')."')<=7 and DATEDIFF(m_enddate,'".date('Y-m-d')."')>=0";break;
		case 6:$sqladd.=" and DATEDIFF(m_enddate,'".date('Y-m-d')."')<=30 and DATEDIFF(m_enddate,'".date('Y-m-d')."')>=0";break;
	}
}
if($group!=''){
	$sqladd.=" and m_groupid=$group";
}
_getcookie('admin_type')=='sitemanage'&&$sqladd.=" and m_site=$admin_site";
_getcookie('admin_type')=='salemanage'&&$sqladd.=" and m_operator='$operator'";
$counts = $db->counter("{$cfg['tb_pre']}member","m_typeid=1 $sqladd",'CACHE');
switch($order){
	case 1:$sqladd.=" order by m_regdate desc";break;
	case 2:$sqladd.=" order by m_logindate desc";break;
	case 3:$sqladd.=" order by m_enddate asc";break;
	default:$sqladd.=" order by m_id desc";
}
$sql="select m_id,m_login,m_pwd,m_name,m_logindate,m_flag,m_typeid,m_groupid,
m_comm,m_regdate,m_logo,m_logostatus,m_logoflag,
m_tel,m_mobile,DATEDIFF(m_enddate,'".date('Y-m-d')."') as end,
m_balance,m_loginnum,m_site,
m_hits,m_startdate,m_enddate from {$cfg['tb_pre']}member where m_typeid=1 $sqladd";
$page= isset($_GET['page'])?$_GET['page']:1;//The default page number
$getpageinfo = page($page,$counts,"person_searchlist.php?segment=$segment&operate=$operate&group=$group&order=$order&keyword=$keyword",20,5);
$sql.=$getpageinfo['sqllimit'];
$query=$db->query($sql);
$memberlist='';
while($row=$db->fetch_array($query)){
	$memberlist.="<tr align=\"center\" onMouseOver=\"this.style.background='#FFFFCC'\" onMouseOut=\"this.style.background='#EEF7FD'\">\r\n";
	
	$memberlist.="<td height=25>Here is the number increasing fill local </td> \r\n; // "written here number increment code
	$memberlist.="<td height=25>$row[m_id]</td>\r\n";
	$memberlist.="<td align=\"left\">";
    $memberlist.=aflags($admin_flags,2,1)?"<a href=\"../member/index.php?at=a&login=$row[m_login]&pwd=".md5($row['m_pwd'])."\" title=\"Click to enter the member center! <br> the last access time: $row[m_logindate]\ "target=\" _blank\ "> $row[m_login]</a> <br>": "<a" title=\ "href=\" #\ last access time: $row[m_logindate]\">$row[m_login]</a><br>";
	$memberlist.="  <a href=\"#\" title=\"Click to view the $row[m_name] basic information!\" onClick=\"window.open ('user_memberinfo.php?id=$row[m_id]','newwindow','height=500,width=550,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no') \">$row[m_name]</a>(";
	$memberlist.=$row['m_flag']?"Normal ":" <font color='#999999'> pending</font>";
	$memberlist.=")";
	$memberlist.="</td>\r\n";
	$memberlist.="<td align=\"left\">";
	if($row['m_logindate']!=$row['m_regdate']){
		$memberlist.="<font color=\"#ff0000\">$row[m_logindate]</font>";
	}else{
		$memberlist.="<font color='#666666'>Login is not yet again</font>";
	}
	$memberlist.="<br>$row[m_regdate]</td>\r\n";
	$memberlist.="<td align=\"center\">";
	if($row['m_logo']!=''){
        $m_logo=$row['m_logo']=='error.gif'?$cfg['path']."upfiles/person/error.gif":$row['m_logo'];
		$memberlist.="<img src=\"images/haveimg.gif\" id=userphoto{$row[m_id]} alt=\"Photo: & lt; br& gt; & lt; img src=$m_logo border=1 width=100 height=120& gt; "width=\" 12\ "height=\" 12\ "border=\" 0\ "onClick=\" show_isven_popup_window ('first step: select Picture',446,272,'../plus/bitmapcutter/uploadphoto.php?id={$row[m_id]}&u={$row[m_login]}&t=1');\"><br>";

Posted by Ignativs at November 09, 2016 - 4:12 AM

The query you have the limit clause does not?
Then you should know that the two parameter limit clause meaning.
Record migration began in the limit, the number of records read

The "start recording offset" is not the starting number you need it?

Posted by Paul at November 18, 2016 - 4:48 AM

Moderator and

Posted by Selma at November 28, 2016 - 5:02 AM

They say the novice, the first floor of the code is too scary.

Posted by Bruno at December 05, 2016 - 5:51 AM

Write a pseudo code
$sql=select * from table limit $frist,$count;
$query=$db->query($sql);
$memberlist='';
$id= $frist;//The initial number assignment
while($row=$db->fetch_array($query)){
echo $id=$id+1;//Assignment
}

Posted by Hubery at December 12, 2016 - 6:28 AM

$page = $_GET['page'];     // The current page
$limit = 10;               // Number per page
$data = $db->select($sql); // Paging query data
echo '<table>';
echo '<tr><th>Number of </th> <th> /th> <the name <th> gender</th></tr>';
$i = 1;
foreach($data as $row){
    echo '<tr>';
    echo '<td>'.($page-1)*$limit+$i.'</td>';
    echo '<td>'.$row['name'].'</td>';
    echo '<td>'.$row['sex'].'</td>';
    echo '</tr>';
    $i++;
}
echo '</table>';

Posted by Egbert at December 20, 2016 - 7:18 AM

The page is not a page=2 or something? Using pagesize* (page-1) +1 and then down to it.

Posted by Gina at December 27, 2016 - 8:15 AM