Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require("dbcon.php"); ?>
- <!DOCTYPE html>
- <html lang="ko">
- <head>
- <meta charset="UTF-8">
- <title>newslist</title>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
- </head>
- <body>
- <table class="table table-bordered table-striped table-condensed">
- <tr>
- <td>번호</td>
- <td>제목</td>
- <td>날짜</td>
- <td> </td>
- </tr>
- <?php
- $sql = "select * from news";
- $rs = $db->query($sql);
- foreach($rs as $row){
- ?>
- <tr>
- <td><?php echo $row['id'];?></td>
- <td class="newstitle">
- <a href="<?php echo $row['id'];?>"><?php echo $row['title'];?></a>
- </td>
- <td><?php echo $row['date'];?></td>
- <td> </td>
- </tr>
- <?php } ?>
- </table>
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- <script>
- $(".newstitle > a").click(function(e){
- e.preventDefault();
- var newsid = $(this).attr("href");
- $.get("newsview.php?newsid=" + newsid, function(data){
- alert(data);
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement