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

Is this possible? If one file assigned to an ID...
I have a page that lists property listings assigned to a specific user (a manage page), with brief t

Simple MySQL script is not working
Hey guys,

Just familiarizing myself with PHP and MySQL. I am following along in the O'Reilly

FROM_UNIXTIME($phpdate);
Hello,

I tried to use this :

$date = FROM_UNIXTIME($phpdate);

ANd I was t

Using loop to count number of entries
I'm writing a program that must ask user to type in numbers. After each entry, the program has to re

modifying a property of an object from a different class
I have 2 classes:
- Math
- Distance

in my math class, I have this line:
$distance =

Inserting into MySQL Newbie
Hi ive got a slight problem where ive made a simple web form where the customer inserts the ammount

get font info from a font file
hello,

Does anyone know how to get font info from a font file ... using php of course !
<

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

Export hangs
Hi all, please help

I have a Oracle 10.2.0.3.0 database. When I want to query the dba_segmen

Variables and Include
Code: [Select]<?php

$header = $_COOKIE['mss']['header'];
$body = $_COOKIE['mss']['b

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