//page1.php
$row=mysql_query("select * from information order by id desc")
while($rs=mysql_fetch_array($row)){
echo '<a href="XX.php?id='.$rs['id'].'">'.$rs['title'].'</a>'
echo '<br/>'
}
以上是输出列表
//page2.php
$id = isset($_GET['id']) ? $_GET['id'] : 0
$row = mysql_query("select * from information where id ={$id}")
$rs = mysql_fetch_array($row)
echo $rs['detail']
//以上输出内容
// 这个很简单的啊.mysql_connect()
mysql_select_db()
mysql_query('set names utf8')
$sql = 'SELECT * FROM tablename'
$r = mysql_query($sql)
if (!$r) exit('Get Data Fail...')
echo '<table><th>标题</th><th>姓名</th><th>时间</th>'
while (true) {
$data = mysql_fetch_assoc($r)
if ($data) {
echo '<tr>'
echo '<td>' . $data['title'] . '</td>'
echo '<td>' . $data['name'] . '</td>' // 你的数据库没有字段 name
echo '<td>' . $data['start_time'] . '</td>'
echo '<td>
<a href="index?tehere-detail-' . $data['id'] . '.html"></a>
</td>' // 这个超链接
echo '</tr>'
} else {
break
}
}
echo '</table>'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)