<?php
require('db_connect.php');
$query="SELECT *FROM xinwen";
$result=mysql_query($query) ;
?>
//返回记录内容
<?
while($row=mysql_fetch_array($result)){
?>
<table width="200" border="1">
<tr>
<td> <?=$row[id]?></td>
<td> <?=$row[title]?></td>
<td> <?=$row[content]?></td>
<td> <?=$row[data]?></td>
<td><a href="update3.php?id=<?=$row[id]?>"><font color="Green">修改</font></a></td>
<td> <a href="delete3.php?id=<?=$row[id]?>"><font color="Red">删除</font></a></td>
</tr>
</table>
<?
}
?>
另一页面如:update3.php
<?php
$conn=mysql_connect ("localhost", "root", "hicc");
mysql_select_db("test");
$exec="select * from xinwen where newsId=".$_GET["id"];
mysql_query("SET NAMES 'GBK'");
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
//echo "新闻内容:".$rs->Content."<br>";
<?php
$conn=mysql_connect ("localhost", "root", "hicc");
mysql_select_db("test");
$exec="select * from news where newsId=".$_GET["newsId"];
mysql_query("SET NAMES 'GBK'");
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
//echo "新闻内容:".$rs->newsContent."<br>";
?>
//我自己的经验,用mysql_array_object ()不能直接调用数据库参数,而是必须通过mysql_array_array()函数返回,再调用。
不知道是是什么原因,只知道这样用才可以。有没有高手告诉我。谢谢。
posted on 2008-11-09 20:17
血海狂鲨 阅读(293)
评论(0) 编辑 收藏 引用 网摘 所属分类:
PHP