Código PHP:
<?php
$idDB = mysql_connect('localhost', 'root', '');
$ok = mysql_select_db('videoclub', $idDB);
$sql1 = 'SELECT IdMovie,Image,Title FROM movies WHERE ((Title LIKE "%'.$words.'%") OR ';
$sql2 = '(Director LIKE "%'.$words.'%") OR (Cast LIKE "%'.$words.'%") OR ';
$sql3 = '(Genre LIKE "%'.$words.'%") OR (Synopsis LIKE "%'.$words.'%") OR ';
$sql4 = '(Producer LIKE "%'.$words.'%")) ORDER BY Title ASC';
$sql = $sql1.$sql2.$sql3.$sql4;
$result = mysql_query($sql, $idDB);
$NumResult = mysql_num_rows($result);
$PageTotal = ceil ($NumResult/5);
if ($NumResult > 0)
{
for ($i = 0; $i <= $NumResult; $i++)
{
$row = mysql_fetch_array($result);
$Data[$i]['IdMovie'] = $row['IdMovie'];
$Data[$i]['Image'] = $row['Image'];
$Data[$i]['Title'] = $row['Title'];
}
}
echo '<table border = "1">';
$Page = $_GET['Page'];
for ($i = $Page*5; $i <= ($Page*5)+4; $i++)
{
if ($i >= 0 && $i <= ($NumResult-1))
{
$row['IdMovie'] = $Data[$i]['IdMovie'];
echo '<tr>';
echo '<td><IMG src="Covers/'.$Data[$i]['Image'].'" width="80" height="120"></td>';
echo '<td><a href="#" onclick=window.open("MovieInfo.php?IdMovie='.$row['IdMovie'].'","MovieInfo","width=600,height=700,scrollbars=yes")>'.$Data[$i]['Title'].'</td>';
echo '<td>';
if ($_SESSION['level'] == 1)
{
include ("Functions/OptionsMovie.php");
}
echo '</td>';
echo '</tr>';
}
}
echo '<tr>';
if ( $Page > 0)
echo '<td><a href = "SearchMovies.php?Page='.($Page-1).'">Anterior</a></td>';
echo '<td>'.$Page.'</td>';
if ( $Page < ($PageTotal-1))
echo '<td><a href = "SearchMovies.php?Page='.($Page+1).'">Siguiente</a></td>';
echo '</tr>';
echo '</table>';
?>
Un saludo y gracias