From: | Anatole Laffreux <gedeon3329(at)yahoo(dot)fr> |
---|---|
To: | "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Paging results from a query |
Date: | 2012-03-04 09:53:39 |
Message-ID: | 1330854819.57394.YahooMailNeo@web29213.mail.ird.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hello
I have this script and would like to get the results paged like in a search
engine. How can I do this ?
<html><body><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Name</td>
<td>Telephone</td>
<td>Activity</td>
<td>Adress</td>
</tr>
<?php
$db =
pg_connect('host=myserver dbname=mydatabase user=postgres
password=mypassword');
$query = "SELECT name,telephone,activity,adress FROM mytable where
activity like '%restaurant%' and city like 'Boston%'";
$result = pg_query($query);
if (!$result)
{
echo "Problem with query " . $query .
"<br/>";
echo pg_last_error();
exit();
}
while($myrow = pg_fetch_assoc($result)) {
printf
("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
$myrow['name'], htmlspecialchars($myrow['telephone']),
htmlspecialchars($myrow['activity']),
htmlspecialchars($myrow['adress']));
}
?>
</table></body></html>
Thanks in advance for help
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Bax | 2012-03-04 12:21:23 | Re: Paging results from a query |
Previous Message | Tareq Aljabban | 2012-03-03 20:12:55 | initDB - storage manager issues |