paginate search result


Posted on 16th Feb 2014 07:03 pm by admin

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;}

Code: <?php
include ("connect.php");
Did you know?Explore Trending and Topic pages for more stories like this.
$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");
?>
No comments posted yet

Your Answer:

Login to answer
74 Like 34 Dislike
Previous forums Next forums
Other forums

newbie question
Hi out thereIm totaly new in this forum and to .net and vb so here is a totaly newbie question.I wan

Probably Easy, Need help with Check Boxes in PHP Code
hello,

Thanks for looking this over and helping me out. My problem is I have a online store l

Mail sending is slow on server
Why mail is taking time to be send on apache-linux server

form variables from database help.
Hi all,

I would like to have a form that gives you options based on the results of an mysql q

Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out wh

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

LOOPing Problem
Hello All!

The following code loops through the data and displays the data accordingly. My p

MVC - Code review
I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to impl

DELETE rows based on content
I have a link in my rows

$bit="http://bit.ly/abcd";
$query = mysql_query("D

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash