<?php

// Nawiązanie połączenia z bazą danych i pobranie wpisu,
// jeśli użytkownik podał jego numer
mysql_connect('localhost','nazwa_uzytkownika','haslo');
mysql_select_db('baza_danych');

$qry = "select ID, post_date_gmt, post_title, cat_name, post_status, " .
       "comment_count from wp_posts, wp_post2cat, wp_categories where " .
       "post_id = ID and cat_ID = category_id order by ID limit 20";
$rows = mysql_query($qry);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Usuwanie w miejscu</title>
<style type="text/css">
table
{
     width: 800px;
}
.delete
{
     background-color: #f00;
     color: #fff;
     font-weight: bold;
     padding: 2px;
}
td
{
     border: 1px solid #ccc;
     margin: 5px;
     padding: 10px;
}
</style>
<script type="text/javascript" src="fat.js">
</script>
<script type="text/javascript" src="addingajax.js">
</script>
<script type="text/javascript" src="data2.js">
</script>
</head>
<body>

<form method="post" action="process2.php">
<table>
<tr>
    <th scope="col">ID</th>
    <th scope="col">Data</th>
    <th scope="col">Tytuł</th>
    <th scope="col">Kategoria</th>
    <th scope="col">stan</th>
    <th scope="col">Liczba<br /> komentarzy</th>
    <th scope="col">Usuń</th>
</tr>
<?php

   if(($rows) && mysql_num_rows($rows) > 0) {
      while($row = mysql_fetch_row($rows)) {
?>
<tr id="tr<?php echo $row[0]; ?>">
   <td><?php echo $row[0]; ?></td>
   <td><?php echo $row[1]; ?></td>
   <td><?php echo $row[2]; ?></td>
   <td><?php echo $row[3]; ?></td>
   <td><?php echo $row[4]; ?></td>
   <td><?php echo $row[5]; ?></td>
   <td><input type="checkbox" name="delete[]" value="<?php echo $row[0]; ?>" /></td>
</tr>
<?php }
    }
?>

</table>
<div>
<input type="submit" value="Aktualizuj" />
</div>
</form>
</body>
</html>
