The reason it doesn't go to other pages is what I explained to you: you are not using LIMIT in your query. It always asks for all the records to be returned, and since you only display the first 5, that is precisely what you see.dramiditis wrote:Hi,
I try with "LIMIT" in the SQL query, but then the script is dead. I have alredy set limit to 5 at the beggining of the script, but when the results is displayed ( with more than 5 ) and I pres "NEXT " it does't goes to the rest of results, but only refresh the same page.
I'm testing this script on one free hosting site, so you can see it:
http://www.videoworld.fancyfreehosting. ... mit=Search
Regards
In order to learn how to make your query do what it needs to do, I suggest you create a test script that does nothing but query the database and display what it returns. Having pages of code makes it very difficult to understand what is going wrong. Open a new file test.php and enter the following:
Code: Select all
<html>
<body>
<?php
include("db.php");
$query="SELECT * FROM video LIMIT 4";
$result = mysql_query($query) or die("Couldn't execute query");
while ($row=mysql_fetch_array($result)) {
foreach($row as $field) {
echo "$field -- ";
}
echo "<br />";
}
?>
</body>
</html>
Code: Select all
$query="SELECT * FROM video LIMIT 3,4";Even better, read http://php.about.com/od/mysqlcommands/g/Limit_sql.htm and http://www.developerfusion.co.uk/show/3998/7/ to learn how LIMIT works in a SQL statement.