Kód: Vybrať všetko
<html>
<head>
<title>Zaradenie</title>
</head>
<body>
<form method='get'>
<?PHP
$connect = mysql_connect($servername,$username,$password);
mysql_select_db($dbname,$connect);
//check if the starting row variable was passed in the URL or not
if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
//we give the value of the starting row to 0 because nothing was found in URL
$startrow = 0;
//otherwise we take the value from the URL
} else {
$startrow = (int)$_GET['startrow'];
}
//this part goes after the checking of the $_GET var
$users = mysql_query("SELECT id,name FROM vtz_users");
$fetch = mysql_query("SELECT id,IMoznacenie,lokalita,miestnost FROM vtz LIMIT $startrow, 10")or
die(mysql_error());
$num=Mysql_num_rows($fetch);
$usernum=Mysql_num_rows($users);
if($num>0)
{
echo "<table border=2 width=700>";
echo "<tr><td>Označenie</td><td width=70>Lokalita</td><td width=70>Miestnosť</td><td width=200>priradit</td><td>X</td></tr>";
for($i=0;$i<$num;$i++)
{
$row=mysql_fetch_row($fetch);
echo "<tr>";
echo"<td>$row[1]</td>";
echo"<td>$row[2]</td>";
echo"<td>$row[3]</td>";
echo"<td>";
echo'<select>';
for($y=0;$y<$usernum;$y++){
$userrow=mysql_fetch_row($users);
echo'<option value="'.$userrow[0].'">'.$userrow[1].'</option>';
}
mysql_data_seek($users, 0);
echo'</select>';
echo"</td>";
echo"<td>X</td>";
echo"</tr>";
}
echo"</table>"; }
$prev = $startrow - 10;
echo '<a href="'.$_SERVER['PHP_SELF'].'?option=com_zaradenie&startrow=0">First</a> ';
if ($prev >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?option=com_zaradenie&startrow='.$prev.'">Previous</a> ';
for($x=1;$x<=10;$x++) {echo '<a href="'.$_SERVER['PHP_SELF'].'?option=com_zaradenie&startrow='.($startrow+($x*10)).'">'.(($startrow/10)+$x+1).'</a> ';}
echo '<a href="'.$_SERVER['PHP_SELF'].'?option=com_zaradenie&startrow='.($startrow+10).'">Next</a>';
?>
</form>
</body>
</html>