FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Edit a record?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Edit a record? [message #176248 is a reply to message #176207] Sat, 10 December 2011 13:02 Go to previous messageGo to previous message
Charles is currently offline  Charles
Messages: 13
Registered: February 2011
Karma:
Junior Member
I have the process down to a fine science in getting data to the
database from the user interface, and I have it down for generating
basidc reports to a printer. I've also designed closed database
applications in the past, so they are not new to me.

Designing a web interface is what's new. Care to recommend any good
references for this part of the project?

On Dec 4, 6:54 am, Arno Welzel <use...@arnowelzel.de> wrote:
> Charles, 2011-12-03 14:28:
>
>> I'm working on an application.  I'm trying to implement an update
>> process that pulls a record out of a MySQL database, updates it, and
>> puts it back.
>
>> Broken down, let's assume I have a database made up of the fields:
>> First_name
>> Last_name
>> Month_of_birth
>> Day_of_birth
>> Year_of_birth
>
> Why not a simple DATE field for birth date?
>
>> The steps I'm finding so far are:
>
>> 1)  Present a data entry form to enter the values on which the record
>> selection is based (an HTML form with 5 input fields...this I have).
>> 1)  Query the database for the record (Submit for processing to a PHP
>> script that opensn the database and submits the values for a SELECT
>> query).
>
>> =========={this is where I am stuck]==============
>
>> 3)  Somehow import those returned values into a form for editting.
>
> Why are you stuck? It's simple to output the values just using echo or
> similar. E.g. if the first name fetched from the db is in $db_firstname:
>
> <input
>    name="firstname"
>    type="text"
>    value="<?php echo htmlspecialchars($db_firstname); ?>" />
>
> And if you want to present multiple records, just create names with an
> index, starting with 0 and increased by 1 with every record:
>
> <input
>    name="firstname[<?php echo $db_rownum; ?>]"
>    type="text"
>    value="<?php echo htmlspecialchars($db_firstname); ?>" />
>
>> 4)  Indicate somehow (in the form) which records (if more than one)
>> need to be returned as updated to the MySQL database.
>
> One possible way:
>
> Pass the original values as hidden fields in the form, so you can
> compare the modified fields with the original values.
>
> OR:
>
> Store the current values as session variables, so you can compare them
> with the modified fields.
>
>> 5)  Somehow post to database
>
> Just use an UPDATE statement in MySQL.
>
> Maybe you should start by learnig the basics about SQL databases,
> session handling and form handling in PHP.
>
> --
> Arno Welzelhttp://arnowelzel.dehttp://de-rec-fahrrad.de
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: regex help
Next Topic: Upload xlsx /xls and save to DB using minimum memory?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 18:34:37 GMT 2024

Total time taken to generate the page: 0.05019 seconds