gambar Gammu success read Inbox
Gammbar minimum database for read or sent sms
import database gammu ba di dapatkan dari Impor format table untuk database 'gammu' Anda dengan menggunakan script 'mysql.sql' pada direktori 'C:\gammu\share\doc\gammu\examples\sql\mysql.sql'
source code baca inbox:
<h1>List Of Inbox </h1>
<?php
$host = "localhost";
$user = "root";
$pass = "";
$database = "lp2msetgammuauto";
mysql_connect($host,$user,$pass);
mysql_select_db($database);
$sql = mysql_query("select * from inbox");
$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 Masuk</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 Masuk (Inbox)<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">Pengirim</font></div></td>
<td width="50%"><div align="center"><font size="2" face="tahoma" color="#FFFFFF">Isi Pesan</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=pesanmasuk.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=pesanmasuk.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=pesanmasuk.php?offset=$newoffset>Next</a></span>";
}
else {
echo "<span class=disabled>Next</span>";//cetak halaman tanpa link
}
echo "</div>";
?>
<?
$hasil = mysql_query("select * from inbox 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[SenderNumber]</font></div></td>
<td><font size=2 face=tahoma>$data[TextDecoded]</font></div></td>
<td><div align=center><font size=2 face=tahoma><a href='hapuspesanmasuk.php?id=$data[ID]'> Hapus</a></font></div></td>
</tr>
";
$k++;
}
echo"</table>";
}
?>
OK semoga membantu
Tidak ada komentar:
Posting Komentar