sori baru smpet dijawab, ni kode nya bwat request kamu yang di :
http://www.dremi.info/forum/posting.php ... f=12&t=387pertama bwat database na:
-- phpMyAdmin SQL Dump
-- version 2.6.2-pl1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 22, 2008 at 09:05 AM
-- Server version: 4.1.12
-- PHP Version: 5.0.4
--
-- Database: `iklan_dbase`
--
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`id` int(11) NOT NULL auto_increment,
`catID` int(11) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `category`
--
INSERT INTO `category` VALUES (1, 1, 'Mobil dan Kendaraan lainnya');
INSERT INTO `category` VALUES (2, 2, 'Hand Phone');
-- --------------------------------------------------------
--
-- Table structure for table `iklan_baris`
--
CREATE TABLE `iklan_baris` (
`id` int(11) NOT NULL auto_increment,
`catID` varchar(50) NOT NULL default '0',
`lead` varchar(150) NOT NULL default '',
`headline` varchar(255) NOT NULL default '',
`content` varchar(255) NOT NULL default '',
`posttime` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `iklan_baris`
--
INSERT INTO `iklan_baris` VALUES (1, '1', 'Dijual murah 1 bh mobil bekas tapi masih bagus', 'Silakan beli sekarang juga, mumpung ada diskon', 'Kondisi mobil masih dalam keadaan bagus, belum pernah pindah tangan. Dibeli tahun 1998, dengan warna merah. Info lebih lanjut hubungi 000000000 (dr.emi)', '2008-10-22 08:40:16');
INSERT INTO `iklan_baris` VALUES (2, '2', 'Menerima pemesanan HP bekas', 'Menerima pemesanan HP bekas, dengan harga terjangkau', 'Hubungi saya bagi siapa aja yang mau. thanks', '2008-10-22 08:40:16');
dan ini script na
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Iklan Baris Be-relasi, by dr.emi</title>
</head>
<body>
<h1>List Iklan baris</h1>
<?
mysql_connect("localhost", "root", "kuda_nonggeng");
mysql_select_db("iklan_dbase");
$q1 = mysql_query("SELECT * FROM category ORDER BY name") or die('err');
while($r1 = mysql_fetch_array($q1))
{
echo "<h3>++ $r1[name]</h3>";
$q2 = mysql_query("SELECT * FROM iklan_baris WHERE catID = '$r1[catID]' ORDER BY posttime DESC");
while($r2 = mysql_fetch_array($q2))
{
echo "<strong>$r2[lead]</strong><br>
<i>$r2[headline]</i><br><br>
$r2[content]<br><br>
Posted on: $r2[posttime]";
}
}
?>
</body>
</html>