Re: Save ability... Duplicate DB entries
| From: | JJ Harrison | Date: | Sun, 11 Aug 2002 00:14:22 +0000 |
| Subject: | Re: Save ability... Duplicate DB entries | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111986@lists.php.net to get a copy of this message | ||
I'll do that. When I load an article I supply the article's id.
--
JJ Harrison
webmaster@tececo.com
www.tececo.com
--
Please reply on the list/newsgroup unless the reply it OT.
"Analysis & Solutions" <danielc@analysisandsolutions.com> wrote in message
news:20020810203159.GA16811@panix.com...
> Hi JJ:
>
> On Sun, Aug 11, 2002 at 01:44:53AM +1000, JJ Harrison wrote:
> >
> > Which has a save or a publish option. I only want to keep one copy of
each
> > article in the DB. This adds a new one each time. I know about updates
in
> > SQL but the file may or may not already be in the db. Does anyone have a
> > good way to go about this?
>
> Here's a quick outline of what I do. I have a form for entering in
> articles. If the form is opened without an ArticleID, the ArticleID (a
> hidden form field) becomes 0. But, if the form is opened with an
> ArticleID, the given ArticleID is put in the hidden field.
>
> Now, when I make my changes and hit the Save (submit) button, the script
> checks the ArticleID. If it's 0, do an insert. If it's non-zero, do an
> update.
>
> --Dan
>
> --
> PHP classes that make web design easier
> SQL Solution | Layout Solution | Form Solution
> sqlsolution.info | layoutsolution.info | formsolution.info
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409