<?php

// NawiÄzanie poĹÄczenia z bazÄ danych i zapytanie o wpis,
// jeĹli jego identyfikator jest dostÄpny
mysql_connect('localhost','nazwa_uzytkownika','haslo');
mysql_select_db('baza_danych');

$qry = "select ID,  post_title from wp_posts 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>Sortowanie przy uĹźyciu biblioteki script.aculo.us</title>
<style type="text/css">
li
{
	background-color: #ffcccc;
	list-style-type: none;
	margin-bottom: 10px;
	padding: 3px;
}
ul
{
	width: 600px;
}
</style>
<script type="text/javascript" src="prototype.js">
</script>
<script type="text/javascript" src="scriptaculous.js">
</script>
<script type="text/javascript">
//<![CDATA[

window.onload=function() {
Sortable.create("firstlist",
     {dropOnEmpty:true,containment:["firstlist"],constraint:false});
}

//]]>
</script>
</head>
<body>

<ul id="firstlist">
<?php

   if(($rows) && mysql_num_rows($rows) > 0) {
      while($row = mysql_fetch_row($rows)) {
?>
   <li><?php echo $row[1]; ?></li>
<?php }
    }
?>
</ul>
</body>
</html>
