Selasa, 23 Juli 2013

PHP Indonesia - Facebook: ini mau numpang tanya,,,,, saya membuat paging de...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
ini mau numpang tanya,,,,, saya membuat paging de...
Jul 24th 2013, 02:40, by Muhammad Ayyas

Muhammad Ayyas 2:40am Jul 24
ini mau numpang tanya,,,,,

saya membuat paging dengan PHP-Oracle,,,,
tetapi g sukses,,,,
mohon bantuan nya,,,,,,

ini source code nya....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
//include "../controller/paging.php";
include "../controller/dbconfig.php";
$db = oci_new_connect('dbharga_des','telkom2013',$dbharga);

?>

<html>
<head>
<title>VIEW KATEGORI</title>
</head>
<body>
<?
$strSQL = "SELECT * FROM P_KATEGORI ORDER BY KAT_ID DESC";
$objParse = oci_parse ($db, $strSQL);
oci_execute ($objParse,OCI_DEFAULT);

//$Num_Rows = oci_fetch_all($objParse, $Result);

$Per_Page = 2; // 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;
}
$Page_End = $Per_Page * $Page;
if ($Page_End > $Num_Rows)
{
$Page_End = $Num_Rows;
}

?>
<table width="600" border="1">
<tr>
<th scope="col" width="70">No</th>
<th scope="col" width="140">ID Kategori</th>
<th scope="col" width="300">Deskripsi Kategori</th>
<th scope="col" colspan="2" width="140">Action</th>
</tr>
<?
$no='';
while (($row = oci_fetch_array($objParse))) {
$no++;

//echo $row['vendor_id'] . "<br>\n";

?>
<tr>
<td align="center"><?php echo $no;?></td>
<td width="140" align="center"><?php echo $row[0];?></td>
<td width="140" align="center"><?php echo $row[1];?></td>
<td width="140" align="center"><a href="../controller/hapus_kategori.php?id=<?php echo $row[0];?>" onClick="return warning();">Hapus</a>
<td width="140" align="center"><a href="../view/edit_kategori.php?id=<?php echo $row[0];?>">Edit</a>

</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> ";
}
oci_close($objConnect);
?>
</body>
</html>

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar