Help me how to solve this problem Topic is solved

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
jitendra_k

Help me how to solve this problem

Post by jitendra_k » Tue Oct 09, 2007 5:29 am

Hi,
  Im novice to Joomla. Plz help me to solve the problem,when im editing any record the record itself newly added each time.
Plz suggest me what can i do?

User avatar
houby
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 30, 2007 5:36 pm
Location: CZ
Contact:

Re: Help me how to solve this problem

Post by houby » Wed Nov 07, 2007 8:44 am

Hi,

On the risk of you having solved it by now, I can say I had the same problem.
It was solved by adding a hidden field to the form, containing the value of
the auto_increment id field in the table of the database.



Hope this helps.

User avatar
ndtoan13
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sun Sep 04, 2005 9:13 am
Contact:

Re: Help me how to solve this problem

Post by ndtoan13 » Wed Nov 07, 2007 1:57 pm

I think your problem is you dont load the record each time you edit it.
This is my code to edit a record. If there is $id of that record, load that record, else, save new.

Code: Select all

$row = new mosDBTable( $database );     
$newitem = false;
if ($id > 0) {
   $new_cat = false;
   $row->load($id);
} else {
   $new_cat = true;
}
Signature Rules: viewtopic.php?f=8&t=65


Post Reply