Hi, I have a movie database set-up and would like to create coding to show each movie in the database on its own page, and give the user links in a "page 1, page 2...." type navgation system. I have attempted this with the coding below but when I run the script in my browser I get the following error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1' at line 4".
Code.
Any help would be greatly appreciated.
Code.
Code:
<?php
$connect = mysql_connect
("host", "username", "password") or
die ("Hey loser, check your server connection!");
mysql_select_db ("database");
$offset=$_REQUEST['offset'];
$query="SELECT movie_name, movie_year
FROM movie
ORDER BY movie_name
LIMIT $offset, 1";
$results=mysql_query($query)
or die(mysql_error());
echo "<table>\n";[/CODE
while ($rows=mysql_fetch_assoc($results)) {
echo "<tr>\n";
foreach($rows as $value) {
echo "<td>\n";
echo $value;
echo "</td>\n";
}
echo "</tr><br>\n";
}
echo "</table>\n";
echo "<a href='page.php?offset=0'>Page 1</a><br>";
echo "<a href='page.php?offset=1'>Page 2</a><br>";
echo "<a href='page.php?offset=2'>Page 3</a><br>";
?>
Comment