一,根据 id 来查询单个的数据

<?php

  require_once '../../conn.php';
$sql = "select * from blogarticle where ID = {$ID}";   
$results = mysql_query($sql);
$blog = mysql_fetch_assoc($results);     //将数值存储到 $blog中
 mysql_free_result($results);

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
     <h1>name : <?php echo $blog['name']; ?>  </h1>
</body>
 
二,输出表的所有数据
<?php
       require_once '../conn.php'; 
    
       @$sql = "select * from blogarticle";
      
       @$results = mysql_query($sql);
 
       while (@$row = mysql_fetch_assoc($results)) {
 
         echo <<<s
          
           <tr>
            <td>{$row['title']}</td>
            <td>{$row['content']}</td>
            <td>{$row['class']}</td>
            <td>{$row['author']}</td>
            <td>{$row['date']}</td>
    <td>
     <a href="../logic/article/delete.php?ID={$row['ID']}">删除&nbsp;</a>|
  <a href="../logic/article/update.php?ID={$row['ID']}">修改</a>
    </td>
          </tr>
s;
}
  mysql_close();
?>

最新文章

  1. PHP实现多图片上传
  2. 关于GPL的一些知识
  3. Eclipse连接到My sql数据库之前操作
  4. Javascript屏蔽回车提交表单
  5. 判断comboBox是否选对了绑定的数据库中的项
  6. 为边框应用图片 border-image
  7. LightOJ 1259 Goldbach`s Conjecture (哥德巴赫猜想 + 素数筛选法)
  8. How to enable DateTimePicker to use both date and time z
  9. haporoxy的keeplaive ZZ
  10. 如何启用第三方Chrome插件
  11. 【gcd】 最大公约数
  12. [Luogu4149][IOI2011]Race
  13. ES 04 - 安装Kibana插件(6.6.0版本)
  14. Windows 10 配置系统环境变量
  15. [OpenCV] Samples 18: Load image and check its attributes
  16. E - Mahmoud and Ehab and the bipartiteness CodeForces - 862B (dfs黑白染色)
  17. 使用GitHub-Pages创建博客和图片上传问题解决
  18. 应用Mongoose开发MongoDB(1)数据库连接
  19. php实现多继承-trait语法
  20. IOS发送Email的两种方法

热门文章

  1. CSP-S2019 爆炸记
  2. Day2-C-迷宫问题 -POJ3984
  3. SpringMVC controller中业务方法的参数、返回值
  4. Commons BeanUtils 中对Map的操作
  5. python 函数map()、filter()、reduce()
  6. NodeJs koa2实现文件上传
  7. elasticsearch-java客户端测试
  8. SpringBoot如何返回页面
  9. spring core:@AliasFor的派生性
  10. 2.11 学习总结 之 ajax