Skip to main content
Inspiring
October 22, 2006
Question

OT: Compare PHP recordset to posted data

  • October 22, 2006
  • 19 replies
  • 1025 views
I am populating a form with data from a recordset for user confirmation.
When the form is submitted, I want to compare the submitted data to the
original data and take action if there are any differences in anything.
What would be the best way to do that?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



This topic has been closed for replies.

19 replies

Inspiring
October 23, 2006

"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ehg66g$sv2$1@forums.macromedia.com...
>I am populating a form with data from a recordset for user confirmation.
>When the form is submitted, I want to compare the submitted data to the
>original data and take action if there are any differences in anything.
>What would be the best way to do that?

One thing I have done in the past is to use JavaScript to set a flag if the
user types into any of the fields. If a "dirty" flag is set, I allow the
form to be submitted and record updated, otherwise not.


--
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/

Cartweaver Development Team
http://www.cartweaver.com

Extending Knowledge Daily
http://www.communitymx.com/


Inspiring
October 22, 2006
I see - thanks for that info. I did not know that.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ehgfu0$9ue$2@forums.macromedia.com...
> Murray *ACE* wrote:
>> You mean you would just update the record, even if nothing has changed?
>
> Bingo. In fact, MySQL does nothing if the update command contains no
> changes.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Inspiring
October 22, 2006
LOL. Nice quote....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Massimo Foti" <massimo@massimocorner.com> wrote in message
news:ehgg49$ahn$1@forums.macromedia.com...
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:ehgf2k$99v$1@forums.macromedia.com...
>> You mean you would just update the record, even if nothing has changed?
>
> Yes, unless the update process is especially slow or cumbersome.
> Often of the times checking for changes is not woth.
>
> To make you feel better about it, I selected something from my collection
> of programming quotes:
>
> Each program has an appropriate level of care and sophistication dependent
> on the uses to which it will be put. Working above that level is, a way,
> even less professional than working below it. If we are to know whether an
> individual programmer is doing a good job, we shall have to know whether
> or not he is working on the proper level for his problem.
> - Gerald M. Weinberg
>
> --
> ----------------------------
> Massimo Foti, web-programmer for hire
> Tools for ColdFusion and Dreamweaver developers:
> http://www.massimocorner.com
> ----------------------------
>
>
>


Inspiring
October 22, 2006
"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ehgf2k$99v$1@forums.macromedia.com...
> You mean you would just update the record, even if nothing has changed?

Yes, unless the update process is especially slow or cumbersome.
Often of the times checking for changes is not woth.

To make you feel better about it, I selected something from my collection of
programming quotes:

Each program has an appropriate level of care and sophistication dependent
on the uses to which it will be put. Working above that level is, a way,
even less professional than working below it. If we are to know whether an
individual programmer is doing a good job, we shall have to know whether or
not he is working on the proper level for his problem.
- Gerald M. Weinberg

--
----------------------------
Massimo Foti, web-programmer for hire
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------



Inspiring
October 22, 2006
Murray *ACE* wrote:
> You mean you would just update the record, even if nothing has changed?

Bingo. In fact, MySQL does nothing if the update command contains no
changes.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Inspiring
October 22, 2006
You mean you would just update the record, even if nothing has changed?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Massimo Foti" <massimo@massimocorner.com> wrote in message
news:ehgbh5$5df$1@forums.macromedia.com...
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:ehgbel$5b8$1@forums.macromedia.com...
>> Thanks - that's tedious. I was hoping there'd be a better way....
>
> Before finding a way, ask yourself if it's really worth doing.
>
>
> --
> ----------------------------
> Massimo Foti, web-programmer for hire
> Tools for ColdFusion and Dreamweaver developers:
> http://www.massimocorner.com
> ----------------------------
>
>


Inspiring
October 22, 2006
"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ehgbel$5b8$1@forums.macromedia.com...
> Thanks - that's tedious. I was hoping there'd be a better way....

Before finding a way, ask yourself if it's really worth doing.


--
----------------------------
Massimo Foti, web-programmer for hire
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------


Inspiring
October 22, 2006
Thanks - that's tedious. I was hoping there'd be a better way....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ehgbd5$59o$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> I am populating a form with data from a recordset for user confirmation.
>> When the form is submitted, I want to compare the submitted data to the
>> original data and take action if there are any differences in anything.
>> What would be the best way to do that?
>
> The only really safe approach is to query the database again when the form
> is resubmitted. Loop through the recordset to compare the values with the
> $_POST array.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Inspiring
October 22, 2006
Murray *ACE* wrote:
> I am populating a form with data from a recordset for user confirmation.
> When the form is submitted, I want to compare the submitted data to the
> original data and take action if there are any differences in anything.
> What would be the best way to do that?

The only really safe approach is to query the database again when the
form is resubmitted. Loop through the recordset to compare the values
with the $_POST array.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/