Building Dynamic Pages For Editing Database Records

This is a discussion on Building Dynamic Pages For Editing Database Records within the PHP Language forums, part of the PHP Programming Forums category; I need to dynamically create a page that allows me to edit records in a a database table. Basically, something ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-10-2008
Ronald Raygun
 
Posts: n/a
Default Building Dynamic Pages For Editing Database Records

I need to dynamically create a page that allows me to edit records in a
a database table. Basically, something very similar to how PHP MyAdmin
works only slighly less complicated. There does not need to be the
ability to edit the structure of the database or tables or anything like
that, simply a listing of the records and the ability to either
edit/delete or create a new record in the table.

I have searched google for a long time but found nothing. Help will be
appreciated.
Reply With Quote
  #2 (permalink)  
Old 05-10-2008
Paul Lautman
 
Posts: n/a
Default Re: Building Dynamic Pages For Editing Database Records

Ronald Raygun wrote:
>I need to dynamically create a page that allows me to edit records in a
> a database table. Basically, something very similar to how PHP MyAdmin
> works only slighly less complicated. There does not need to be the
> ability to edit the structure of the database or tables or anything
> like that, simply a listing of the records and the ability to either
> edit/delete or create a new record in the table.
>
> I have searched google for a long time but found nothing. Help will be
> appreciated.


Well I put
php database admin form
into google and clicked "I'm feeling lucky" and found one??


Reply With Quote
  #3 (permalink)  
Old 05-10-2008
sheldonlg
 
Posts: n/a
Default Re: Building Dynamic Pages For Editing Database Records

Ronald Raygun wrote:
> I need to dynamically create a page that allows me to edit records in a
> a database table. Basically, something very similar to how PHP MyAdmin
> works only slighly less complicated. There does not need to be the
> ability to edit the structure of the database or tables or anything like
> that, simply a listing of the records and the ability to either
> edit/delete or create a new record in the table.
>
> I have searched google for a long time but found nothing. Help will be
> appreciated.


What is so difficult? Just build an array with the database fields,
generated a table with <tr>s between each field and have there be two
columns -- one with the name printed and the other with text input and
have the name of the text field be the name of the db field. Then add a
submit button and process the form. In the php target, simply extract
the values of all the fields and do an update of the db. Have the id
field always be first so that you know how to do the where clause.

You can get the field names with mysql_list_fields, although it is
deprecated. You could use mysql_query with "SHOW COLUMNS FROM table foo".

This seems like less than an hour's work.
Reply With Quote
  #4 (permalink)  
Old 05-10-2008
sheldonlg
 
Posts: n/a
Default Re: Building Dynamic Pages For Editing Database Records

sheldonlg wrote:
> Ronald Raygun wrote:
>> I need to dynamically create a page that allows me to edit records in
>> a a database table. Basically, something very similar to how PHP
>> MyAdmin works only slighly less complicated. There does not need to be
>> the ability to edit the structure of the database or tables or
>> anything like that, simply a listing of the records and the ability to
>> either edit/delete or create a new record in the table.
>>
>> I have searched google for a long time but found nothing. Help will be
>> appreciated.

>
> What is so difficult? Just build an array with the database fields,
> generated a table with <tr>s between each field and have there be two
> columns -- one with the name printed and the other with text input and
> have the name of the text field be the name of the db field. Then add a
> submit button and process the form. In the php target, simply extract
> the values of all the fields and do an update of the db. Have the id
> field always be first so that you know how to do the where clause.
>
> You can get the field names with mysql_list_fields, although it is
> deprecated. You could use mysql_query with "SHOW COLUMNS FROM table foo".
>
> This seems like less than an hour's work.


I missed that you want it like phpMyAdmin. In that case, have multiple
columns, each being the name of a different field and have the rows be
the data selected. In that case, add buttons for update.
Reply With Quote
  #5 (permalink)  
Old 05-11-2008
Jeff North
 
Posts: n/a
Default Re: Building Dynamic Pages For Editing Database Records

On Sat, 10 May 2008 17:27:24 +0100, in comp.lang.php Ronald Raygun
<invalid@domain.com>
<hp-dnadbi-peUbjVnZ2dnUVZ8q2dnZ2d@bt.com> wrote:

>| I need to dynamically create a page that allows me to edit records in a
>| a database table. Basically, something very similar to how PHP MyAdmin
>| works only slighly less complicated. There does not need to be the
>| ability to edit the structure of the database or tables or anything like
>| that, simply a listing of the records and the ability to either
>| edit/delete or create a new record in the table.
>|
>| I have searched google for a long time but found nothing. Help will be
>| appreciated.


This is by no means a simple task.
I've written something like this but at the present time it is not
worthy of distribution. There are too many manual steps still required
to get it to work.

I'll do a bit more work on it and put the code somewhere to make it
available. This could take a while though :-(
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:21 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0