Welcome Guest, Not a member yet? Register   Sign In
Making sure a record hasn't changed
#1

[eluser]michaelh99[/eluser]
To get the preliminaries out of the way...
1) I'm new to PHP.
2) I'm new to CI.
3) I'm new to database development.
4) I've been programming for decades.
5) I'm working on a site that's heavily database driven and the design's been worked out with someone who knows DB well.

Ok. The problem I'm having is likely due to ignorance about CI or PHP (and maybe a little SQL) so if after I get to describing the problem you can point me to some links for additional reading that would be fine. Reading doesn't scare me, I just haven't found what I think I need when searching here or the rest of the Intertubes.

I've gotten far enough with the site that a single user can go through and add stories which are composed of paragraphs and finally sentences (not really but this is a simpler analogy).

What I want now is to verify that when editing any of the three elements that some other user hasn't already modified the record.

I've got a controller function that looks something like:

function editstory($story)
{
set up all the $data for the view
*** get the last update time for $story
Set the form validation rules
if form_validation_run == false
{
re-load this view, passing in $data
}
else
{
check the update times, make sure they're the same
reload the view if they aren't
}
}

The problem is that the form submit calls editstory (which is the pattern I've seen in all the samples and docs so far) which sets up all the data again before running the validation, blowing away the data I'd saved last time.

Does this make sense? What am I missing here?


Messages In This Thread
Making sure a record hasn't changed - by El Forum - 07-09-2011, 08:53 AM
Making sure a record hasn't changed - by El Forum - 07-09-2011, 11:58 AM
Making sure a record hasn't changed - by El Forum - 07-09-2011, 12:27 PM
Making sure a record hasn't changed - by El Forum - 07-14-2011, 05:49 AM
Making sure a record hasn't changed - by El Forum - 07-16-2011, 05:44 PM
Making sure a record hasn't changed - by El Forum - 07-17-2011, 10:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB