寫入多組分頁的值

後台能手動調整點擊率來改變原本直接依點擊率來排的功能

前台submit寫法,是用js來送表單因為是以圖片來做按鈕效果

...省略
//用來填入加權的欄位
mysql的update語法
if($_GET['cmd']=="weighting"){
         //要先設定哪一頁來的資料
	$now=($_GET['now_Page']-1)*15;
	$sql="select * from news order by createDate DESC limit ".$now.",15";
	$result=mysql_query($sql,$cn);
	while($rs=mysql_fetch_array($result)){

		$clickT=$_POST['a'.$rs['id']]+$rs['clickNum'];

		$sql2="UPDATE news SET weighting='".$_POST['a'.$rs['id']]."',";
		$sql2.="clickNum='".$clickT."'";
		$sql2.="where id=".$rs['id'];

		$result2=mysql_query($sql2,$cn);
	}
	
	alertBox('儲存成功',"index.php?type=".$_GET['type']."&now_Page=".$_GET['now_Page']);
	
}

Previous
Next Post »