I have Google how to do this but I cant figure it out. So this is my code:
<?php
session_start();
Function PrintAll() {
echo "<center>";
echo "Filmpje Nummer: ".$_SESSION['hits'];
echo "</center>";
$dbnaam = "a2943462_Pages";
$connection = mysql_connect($dbhost,$uname,$pass) or die ("niet gelukt om als $user te connecten met $host");
$result = mysql_select_db($dbnaam,$connection);
$sql = "SELECT * FROM PagesInfo WHERE ID=".$_SESSION['hits']; // sql select query
$result = mysql_query($sql, $connection);
while ($rij = mysql_fetch_array($result))
{
echo "<center>";
echo "<h3>" . $rij["Title"] . "</h3>";
echo $rij["Video"] . "<br/>";
echo "<p>" ."Posted By: " . $rij["Posted"] . "</p>";
echo "</center>";
}
}
function ShowButtons() {
echo "<html>
<head><title>COUNTER</title>
<link rel='stylesheet' type='text/css' href='style.css'/>
</head>
<body><center>
<form method='get'>
<input type='submit' name='Previous' value='<< Previous'/>
<input type='submit' name='Next' value='Next >>'/>
</form></center>
</body>
</html>";
}
function DisPre() {
echo "<html>
<head><title>COUNTER</title>
<link rel='stylesheet' type='text/css' href='style.css'/>
</head>
<body><center>
<form method='get'>
<input type='submit' name='Next' value='Next >>'/>
</form></center>
</body>
</html>";
}
if($_GET){
$pageShow = $_SESSION['hits'];
if(isset($_GET['Next'])){
$_SESSION['hits']++;
PrintAll();
}elseif(isset($_GET['Previous'])){
if ($_SESSION['hits'] < 1) {
echo "Cannot go further Back";
DisPre();
}else{
$_SESSION['hits']--;
PrintAll();
}
}
}
if(isset($_SESSION['hits'])){
if ($_SESSION['hits'] < 1){
disPre();
}else{
ShowButtons();
}
}else{
$_SESSION['hits']=1;
PrintAll();
}
?>
So how and where do i have to Add a code that does this:
If it doesn't find any rows in the Table PagesInfo then it will Echo this:
echo "<center><img src='Sourceher' height='390px' width='640px' /></center>";
Maybe someone can put the code inside my code ?? Any help is much appreciated.