Postet av: {$_POST['name']}
{$_POST['message']}
Postet: $tid
";
$query = "INSERT INTO guestbook (inputText) VALUES ('$mess');";
sqlite_query($dbc,$query);
header("Location: {$_SERVER['PHP_SELF']}");
}
$query = "SELECT inputText FROM guestbook ORDER BY inputId DESC;";
$array = sqlite_single_query($dbc,$query);
if(count($array)>15){
$extrapages = floor(count($array)/15);
$extrapages++;
if (count($array)%15 == 0){
$extrapages--;
}
if($_GET['page']){
$num = $_GET['page'] * 15;
for($i=$num;$i |
";
if($array && is_array($array)){
foreach ($array as $input){
echo "| $input |
\n";
}
} elseif ($array){
echo "| $array |
";
} else {
echo " | Ingen innleg enda!
";
}
echo "";
if ($extrapages != 0){
echo extrapages($extrapages);
}
}
function extrapages($num){
$to = "| ";
for($i=0;$i<$num;$i++){
$top = $i+1;
$to .= "$top ";
}
$to .= " |
";
return $to;
}
?>