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");
$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

Checking if a process is running (problems including psapi.dll i think...)
Ok, so all I'm trying to do is check if a program is running...

I've found out that I nee

my two tables
table1 : col1 = topicid , col2 = topic

table2 : col1 = sentid, col2 = sentence

Cod

Can I call a class inside a function?
I have a class written in another file that handles my image resizing.

Can I do this (php say

my login script page is not working on remote computers
hi my login is working on my computer, but when i tried 2 computers from 2 different locations, they

private constructor
Hello,

Can we create a constructor as private? If yes, what is the use of it? If no, why can'

Inserting a check in checkbox from array value
Hello all,
I have a bit of code that works for a select option box, but does not work for my chec

firefox wouldnt stream mp3 files completely from my php page
hi everyone,
I have a php file trying to read and stream mp3 files. It works fine in IE but my pr

Do something every fifth time?
I'm trying to write a loop, but I want it to do something different after every fifth instance. Like

Help with Contact Form
I have this Form on an html page and the associated code on page.php (below).
I keep getting the

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

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