순위 입력.. rank
페이지 정보
본문
// 입력시
$cu_uid = mysql_insert_id(); //입력시나 수정시 해당 uid
//해당 uid를 제외한 순위 업데이트
$Rsql = "select * from table_name where 조건문 order by rank";
$Rresult = mysql_query($Rsql);
$i = 1;
while ($Rrow = mysql_fetch_array($Rresult)){
if($i == $rank) $i++;
$RUsql = "update tabel_name set rank ='$i' where uid = '$Rrow[uid]'";
$RUresult = mysql_query ($RUsql);
$i++;
}
// 해당 uid 순위 update
$RUsql2 = "update table_name set rank ='$rank' where uid = '$cu_uid'";
$RUresult2 = mysql_query ($RUsql2);
######################################################################
function OrderBy($rank, $TableName, $uid) {
if(!$rank) $rank = 1;
$Rquery = mysql_query("select * from $TableName where uid != '$uid' order by rank");
$i = 1;
while($Rrow = mysql_fetch_array($Rquery)){
if($i == $rank) $i++;
$RUquery = mysql_query("update $TableName set rank = '$i' where uid='$Rrow[uid]'");
$i ++;
}
$RUquery = mysql_query("update $TableName set rank = '$rank' where uid='$uid'");
}
$cu_uid = mysql_insert_id(); //입력시나 수정시 해당 uid
//해당 uid를 제외한 순위 업데이트
$Rsql = "select * from table_name where 조건문 order by rank";
$Rresult = mysql_query($Rsql);
$i = 1;
while ($Rrow = mysql_fetch_array($Rresult)){
if($i == $rank) $i++;
$RUsql = "update tabel_name set rank ='$i' where uid = '$Rrow[uid]'";
$RUresult = mysql_query ($RUsql);
$i++;
}
// 해당 uid 순위 update
$RUsql2 = "update table_name set rank ='$rank' where uid = '$cu_uid'";
$RUresult2 = mysql_query ($RUsql2);
######################################################################
function OrderBy($rank, $TableName, $uid) {
if(!$rank) $rank = 1;
$Rquery = mysql_query("select * from $TableName where uid != '$uid' order by rank");
$i = 1;
while($Rrow = mysql_fetch_array($Rquery)){
if($i == $rank) $i++;
$RUquery = mysql_query("update $TableName set rank = '$i' where uid='$Rrow[uid]'");
$i ++;
}
$RUquery = mysql_query("update $TableName set rank = '$rank' where uid='$uid'");
}
- 이전글엑셀(excel)파일로 다운로드 받기 header 21.02.09
- 다음글onmouse 시 다른 페이지 보여주는 레이어작업 21.02.09
댓글목록
등록된 댓글이 없습니다.