$lodMembers="Select Member_id from tbl_member where Member_id LIKE '%M%' ORDER BY Member_id DESC";
$reult=mysql_query($lodMembers) or die(mysql_error());
$row=mysql_fetch_array($reult);
$lodMembers1=$row['Member_id'];
if (count($row)>0) {
$temp=(($lodMembers1));
$temp=intval(substr($temp, 1, strlen($temp)))+1;
$txtMemberid="M".str_repeat("0", 5-intval(strlen($temp))).intval($temp);
}else{
$txtMemberid="M00001";
}