Re: [newbie] simple browse / edit form in PHP

From: Chris <csmith(at)squiz(dot)net>
To: julesa(at)arbodienst-limburg(dot)nl, pgsql-php(at)postgresql(dot)org
Subject: Re: [newbie] simple browse / edit form in PHP
Date: 2002-03-14 21:53:45
Message-ID: 5.1.0.14.0.20020315084826.02525470@cooee.cybersydney.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hi,

>i have a test setup with postgresql 7.2, PHP 4, and apache. everything
>works fine, PHP generates HTML pages with query results in it. now i
>want to create a simple form which shows the current record, and has
>these buttons:
>
>- previous, first, next, last record
>- delete record
>- add record
>
>it sounds very simple, but where do i start? i guess i should make a
>stateless connection (the form will be accessed via the web). i figure
>i need some sort of recordset, is a CURSOR the right approach? maybe
>someone can point me to an example?

For the previous / next buttons, I use 'LIMIT / OFFSET' with the queries.

For example to show 10 records each page,
on the first page:

query = SELECT ..... LIMIT 10 OFFSET 0

the second page:

query = SELECT ..... LIMIT 10 OFFSET 10

etc

For adding or deleting a record, you'll have to do up a form of some type
to get the data.

I'll leave the practicalities to you :)

-----------------
Chris Smith
http://www.squiz.net/

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Gurudutt 2002-03-15 04:18:51 Re: Graphics
Previous Message Marcelo Pereira 2002-03-14 18:05:04 Re: Graphics