Hi.
Heres the problem. I have a form which returns values and stores them
in a database. When a person presses submit on the form I want the ID
to stay the same but the rest of the data in the table to be replaced.
What it is doing at the current moment is only replacing the data that
has changed. I dont want this. What i want to do is blank all fields
in the table then add the new data. Heres the code and will give you a
better idea of what im trying to do.

Notes
id is of type integer and is the primary key and set to
auto_increment.


$databaseData = $this->Template->query("SELECT * FROM templates WHERE
sender_id = ".$sender_id);

if(!empty($this->data)) {

                        $this->data['template']['sender_id'] = $sender_id; 
//putting
sender_id into the array

                        if(empty($databaseData)) {
                                $this->Template->id=null; //no template table 
for this sender so
create 1
                                $this->Template->save($this->data); //save the 
data (this part
works 100%)
                        } else {
                                
$this->Template->del($databaseData[0]['templates']['id']); //
delete that row to make it "blank/empty"
                                
$this->Template->id=$databaseData[0]['templates']['id']; //Go to
that ID that was deleted
                                $this->Template->save($this->data); // Save the 
data to the row
with the id that was deleted
                        }
}

what it does is it keeps increasing the id instead of using the old
one. This happens due to auto_increment pointer .
Is there any way to bypass this like delete data from the row except
the id? Any help would be greatly appreciated.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to