posts - 24,  comments - 0,  trackbacks - 0

<?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>&nbsp;<?=$row[id]?></td>
    <td>&nbsp;<?=$row[title]?></td>
    <td>&nbsp;<?=$row[content]?></td>
    <td>&nbsp;<?=$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

只有注册用户登录后才能发表评论。
网站导航:
<2008年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

留言簿(1)

随笔分类(20)

随笔档案(24)

相册

www.csdn.net

搜索

  •  

最新评论

阅读排行榜

评论排行榜