Halloww...newbie nih...pengen nanya , begini , saya menulis script
PHP+mysql buat news di website sekolah,di script itu ada alur logika yg
menampilkan 5 buah news tiap halaman yg keluar,tp knp waktu saya pindah
ke halaman 2 , berita yang keluar tetap yang ada di halaman yang pertama
, sedangkan berita yang di seharusnya dihalaman 2[berita yang sudah
lewat] tidak keluar.....mohon bantuannya.
berikut script yang saya buat ::

news.php

<?
//Copyright (c) Carolus Agung 2004 ; This code just for SMU Fons Vitae I
- OpeNuxIndo.org Core
$conn=mysql_connect("localhost","root","");
if ($conn) {
mysql_select_db("fv_database");
if (empty($awal))
$awal=0;
$query=mysql_db_query("fv_database","select * from fv1_news 
order by news_id desc limit $awal,5");
$row=mysql_fetch_row($query);
if(!$row)
die ("error");
do {
list($id,$tanggal,$judul,$headline,$isi,$penulis)=$row;
print("<B><a href='show_news.php?news_id=$id'>$tanggal :
$judul</a></B><br>");
print("$headline\n<br>");
} while ($row=mysql_fetch_row($query));
$query2=mysql_db_query("fv_database","select * from fv1_news");
$jumlah=mysql_num_rows($query2);
$i=$jumlah/5;
$i=ceil($i);
print ("Halaman : ");
for ($j=1;$j<=$i;$j++) {
$awal=(($j-1)*4+$j)-1;
print ("[<a href='news.php?awal=$awal&page=$j'>$j] \n");}
} else {
echo "Gagal Menampilkan Berita"; }
?>

add_news_fv.php

<?
//Copyright (c) Carolus Agung 2004 ; This code just for SMU Fons Vitae I
- OpeNuxIndo.org Core
$conn=mysql_connect("localhost","root","");
if ($conn) {
mysql_select_db("fv_database");
$tanggal=date("d-m-y");
echo "<br><br>Artikel Anda adalah :<br><br>";
echo "<table width='50%' border='0' cellspacing='0'
cellpadding='0'><tr><td>";
        echo "<b>$tanggal</b><br>";
        echo "<b>$_POST[judul]<br></b>";
        echo "oleh $_POST[penulis]<br>";
        echo "$_POST[isi]<br>";
        echo "</td></tr></table><br>";

$sqlstr="insert into fv1_news(tanggal,judul,headline,isi,penulis)
values('$tanggal','$_POST[judul]','$_POST[headline]','$_POST[isi]','$_POST[penulis]')";
$hasil=mysql_query($sqlstr,$conn);
echo "Berita Berhasil Dimasukan !";
mysql_close($conn); }
else {
echo "Berita Gagal Dimasukan !"; }

?>

news_tester.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN
                "http://www.w3.org/TR/html4/loose.dtd"";>
<html>
<head>
  <title>News Tester</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="GENERATOR" content="Quanta Plus">
</head>
<body>
  <h1>News Tester</h1>
  <form action="add_news_fv.php" method="POST"
enctype="multipart/form-data">
  <table width=502 cellspacing=0 cellpadding=0>
        <tr>
        <td width="165"><div align="left">Judul Berita : </div></td>
                <td width="337"><input type="text" name="judul" size=30
maxlength="255"></td>
        </tr>
        </table>
        <br>
        <table width=502 cellspacing=0 cellpadding=0>
        <tr>
                <td width="165"><div align="left">Headline : </div></td>
                <td width="337"><textarea  name="headline" cols="30"
rows="5"></textarea></td>
        </tr>
    </table>
        <br>
        <table width=502 cellspacing=0 cellpadding=0>
        <tr>
                <td width="165"><div align="left">Isi Berita : </div></td>
                <td width="337"><textarea name="isi" cols="30"
rows="10"></textarea></td>
        </tr>
    </table>
        <br>
        
    </table>
        <br>
        <table width=502 cellspacing=0 cellpadding=0>
        <tr>
                <td width="165"><div align="left">Penulis : </div></td>
                <td width="337"><input type="text" name="penulis" size=30
maxlength=255></td>
        </tr>
    </table>
        <br>
        <table width=502 cellspacing=0 cellpadding=0>
        <tr>
                <td width="502"><div align="left"><input type="submit" name="submit"
value="Kirim"></div></td>
        </tr>
    </table>
  </form>
</body>
</html>

show_news.php

<?
//Copyright (c) Carolus Agung 2004 ; This code just for SMU Fons Vitae I
- OpeNuxIndo.org Core
$conn=mysql_connect("localhost","root","");
if ($conn) {
mysql_select_db("fv_database");
$query=mysql_db_query("fv_database","select * from fv1_news where
news_id='$_REQUEST[news_id]'");
$row=mysql_fetch_row($query);
if(!$row)
die("Error");
do {
list($id,$tanggal,$judul,$headline,$isi,$penulis)=$row;
print("<table width=50% border=0 cellpadding=0 cellspacing=0><tr><td>");
print("<b>$tanggal<br>$judul<br></b>oleh $penulis<br>$isi\n<br>");
print("</td></tr></table><br>");} while
($row=mysql_fetch_row($query));
} else {
echo "News gagal ditampilkan"; }
?>



-- 
Unsubscribe: kirim email kosong ke [EMAIL PROTECTED]
Arsip, FAQ, dan info milis di http://linux.or.id/milis.php
Tidak bisa posting? Baca:
http://linux.or.id/wiki/index.php?pagename=ProblemMilisDanSolusi
http://linux.or.id/wiki/index.php?pagename=TataTertibMilis

Kirim email ke