<? include"config.php"; $page=$_GET['page']; if(!$id){ $id=1; } if(!$page){ $page=1; } $start=$page*4; $rs = mysql_query("select * from htmlpage where type_htmlPage='Artists' AND status='1' DESC LIMIT $start,4"); unset($rs['count']); $count=0; while($dbarr=mysql_fetch_array($rs)) { if($count%1==0) { echo"<table width='100%'>"; } echo"<tr>"; echo"<td width='10%' align='left' valign='top'><img src='uploadfiles/$dbarr[thumnail]' width='70' height='75' /></td>"; echo"<td width='90%' align='left' valign='top'><div id='title'><a href='artists_detail.php?id=$dbarr[id_htmlPage]'>$dbarr[title]</a></div> <br> <div id='date'>$dbarr[date_page]</div> </td>"; echo"<td width='90%' align='left' valign='top'> </td>"; echo"</tr>"; echo"</table>"; echo "<br>"; if($count%1==1){ echo '</tr>'; } $count++; } if($i%1==1){ echo '<td width="150" height="160"></td></tr>'; } ?> </div> </td> <td width="12%" align="right" valign="bottom"><img src="images/bg/bd.png" width="71" height="253" /></td> </tr> <tr> <td align="left" valign="top"> </td> <td align="left" valign="bottom"> <div id="page"><? $sqlstr="select * from htmlpage where type_htmlPage='Artists' AND id_htmlPage ='$id'"; $result=mysql_query($sqlstr); $count = $result['count']; $totalpage=round($count/4 +.5); if($page!=1){ $pre=$page-1; echo '<td width="50" height="20"><div id="page"><a href="artists.php?id='.$id.'&page='.$pre.'"><font class="otherpage" >PREV</font></a></div></td>'; } for($i=1;$i<=$totalpage;$i++){ if($i==$page){ echo '<td width="20" height="20"><div id="page"><a href="artists.php?id='.$id.'&page='.$i.'"><font class="thispage">'.$i.'</font></a></div></td>'; } else{ echo '<td width="20" height="20"><div id="page"><a href="artists.php?id='.$id.'&page='.$i.'"><font class="otherpage" >'.$i.'</font></a></div></td>'; } } if($page!=$totalpage){ $next=$page+1; echo '<td width="50" height="20"><div id="page"><a href="artists.php?id='.$id.'&page='.$next.'"><font class="otherpage" >NEXT</font></a></div></td>'; } ?>
<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <? $objConnect = mysql_connect("localhost","root","root") or die(mysql_error()); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM gallery"; $objQuery = mysql_query($strSQL); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 4; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $strSQL .=" order by GalleryID ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>"; $intRows = 0; while($objResult = mysql_fetch_array($objQuery)) { echo "<td>"; $intRows++; ?> <center> <img src="thaicreate/<?=$objResult["Picture"];?>"><br> <?=$objResult["GalleryName"];?> <br> </center> <? echo"</td>"; if(($intRows)%2==0) { echo"</tr>"; } } echo"</tr></table>"; ?> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } ?> </body> </html> <? mysql_close($objConnect); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง