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

Multi Dimensional Array Append
Hi Guys

I have a function that returns a multidimentional array eg

$result = functio

Help Ordering Arrays
Hi, I have 3 arrays as shown below.

Code: $users = $this->get_latest_users();
$flir

Error with Font and imagettfbbox
I keep getting an error that says "Warning: imagettfbbox() [function.imagettfbbox]: Could not f

some questions
Hello,

I am looking for the answers for following questions:

1) Does PHP support overl

if description does not contain the following words
Hello everyone,

I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa

Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have

Pspell with my own dictionary
Hello!
I've tested two cases using pspell functions.
1)
Code: $dictionary_link = pspell_new

Linking with Foreign Keys
I have been getting an erro when I try and link:

create table Faculty_Specialty (I_Name v

Sending an SMS Message with ASP.NET
Often times it may be a requirement for your web application to send an SMS message. Such examples w

SQL query not working well
Hi,
I made a small table with 5 rows and want to make them an sql consult using rownum

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