Minggu, 09 November 2014
PHP code to read sent Item Using Gammu
gambar gammu to read sent item
<?php
include "koneksi.php";
$sql = mysql_query("select * from sentitems");
$hitung = mysql_num_rows($sql);
$offset = $_GET['offset'];
//Jumlah data yang ditampilkan per halaman
$limit = 5;
if (empty ($offset) ){
$offset = 0;
}
if ($hitung == 0){
echo "<br><font face=tahoma size=2><div align=center>Tidak Ada Pesan Terkirim</div></font>";
}
else {
?>
<center>
<table border="0" cellpadding="0" cellspacing="0" width="70%">
<tr >
<td height="30" width=100%>
<div align="left"><font size="3" face="tahoma">Semua Data Pesan Terkirim (sentitems)<br></font>
<font face="tahoma" size="2">Jumlah Data : <?php echo "$hitung";?><hr color=#CCCCFF></font></div></td>
</tr>
</table>
<table border="1" cellpadding="0" cellspacing="0" width="70%">
<tr bgcolor="#999999" align="center">
<td width="2%"><div align="center"><font size="2" face="tahoma" color="#FFFFFF">No</font></div></td>
<td width="20%"><div align="center"><font size="2" face="tahoma" color="#FFFFFF">Time</font></div></td>
<td width="18%"><div align="center"><font size="2" face="tahoma" color="#FFFFFF">No Tujuan</font></div></td>
<td width="40%"><div align="center"><font size="2" face="tahoma" color="#FFFFFF">Isi Pesan</font></div></td>
<td width="15%"><div align="center"><font size="2" face="tahoma" color="#FFFFFF">Status</font></div></td>
<td><div align="center"><font size="2" face="tahoma" color="#FFFFFF"> Aksi </font></div></td>
</tr>
<?
echo "<div class=paging>";
if ($offset != 0){
$prevoffset = $offset - 5;
echo "<span class=prevnext><a href=pesanterkirim.php?offset=$prevoffset>Back</a></span>";
}
else {
echo "<span class=disabled>Back</span>"; //cetak halaman tanpa link
}
//hitung jumlah halaman
$halaman = intval($hitung/$limit); //Pembulatan
if ($hitung%$limit){
$halaman++;
}
for ($i=1; $i<=$halaman; $i++) {
$newoffset = $limit*($i-1);
if ($offset != $newoffset){
echo "<a href=pesanterkirim.php?offset=$newoffset>$i</a>";
}
else {
echo "<span class=current>".$i."</span>";//cetak halaman tanpa link
}
}
//cek halaman akhir
if (! (($offset/$limit) + 1 == $halaman) && $halaman !=1){
//jika bukan halaman terakhir maka berikan next
$newoffset = $offset + $limit;
echo "<span class=prevnext><a href=pesanterkirim.php?offset=$newoffset>Next</a></span>";
}
else {
echo "<span class=disabled>Next</span>";//cetak halaman tanpa link
}
echo "</div>";
?>
<?
$hasil = mysql_query("select * from sentitems limit $offset,$limit");
$k = 1 + $offset;
while($data = mysql_fetch_array($hasil)){
echo"
<tr valign=top>
<td height=24><div align=center><font size=2 face=tahoma>$k</font></div></td>
<td><div align=center><font size=2 face=tahoma>$data[UpdatedInDB]</font></div></td>
<td><div align=center><font size=2 face=tahoma>$data[DestinationNumber]</font></div></td>
<td><font size=2 face=tahoma>$data[TextDecoded]</font></div></td>
<td align='center'><font size=2 face=tahoma>$data[Status]</font></div></td>
<td><div align=center><font size=2 face=tahoma><a href='hapuspesanterkirim.php?id=$data[ID]'> Hapus</a></font></div></td>
</tr>
";
$k++;
}
echo"</table>";
}
?>
ok....semoga membantu
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar