PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi, I have a paginations script to display data from my database but i would like to paginate someones search results. I have this script but get an error that says "syntax error, unexpected '=', expecting '}'" for this if(!$start){$start = 0;}
<?php
include ("connect.php");
$per_page = 20;
$start = $_GET ['start'];
$record_count = mysql_num_rows (mysql_query("SELECT * FROM flats WHERE `location` LIKE '%$keyword%' OR
`location` LIKE '%$keyword%'));
$max_pages = $record_count / $per_page; // may come out as a decimal
if(!$start){$start = 0;}
$get = mysql_query("SELECT * FROM flats WHERE `location` LIKE '%$keyword%' OR
`location` LIKE '%$keyword%' ORDER BY date_posted DESC LIMIT $start, $per_page");
?>
line 6 , the second part of your record_count query you didn't close your query. opened it with a " and didn't close it. Try using a PHP editor that does text highlighting so these kinds of errors reach out and touch you.
thanks, I have one more problem. the prev 1 2 3 4 next is not giving the result i want. I get the error msg:
Notice: Undefined index: submit, Notice: Undefined index: search
you didnt submit a keyword.
I know that when i press page 2 it reads search.php again but I dont know how to solve it.