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

include function being weird?
I have a very simple system to grab an IP outputted by a PHP file.. (for a project I have) but it ou

Functions Not Loading Into Div
I had some help doing some of this but what I'm trying to do is get my functions to retrieve its val

$GPRMC and NMEA how to extract from report
Hi There,

Im a little bi lost and not sure where to start with this one, ive got a small gps

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

TCP Sending Unsigned Char...
Hi...

I want to send over tcp/ip some data, i have the data in hexadecimal, and when i tr

list files from folder, only one for each date
I have many files in a folder and wish to only list one of each date

these are the file names

upload control not working with update panel
Hi,

I am working with Asp.Net FileUpload control with ajax update panel,

if i use the

Create comparison matrix?
I want to create a comparison script for forum software and was wondering is there any tutorial or b

Got A Free Server :(
So I was given a free server

http://shopping.yahoo.com/p:Compaq%20ProLiant%201500%20Server:1

need help about
i store the value of my select statement result to an array and stored it to a variable named $fname

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