You can use REPLACE instead of making two separate queries (UPDATE and
INSERT) because it checks if it is there, and if it's not, then it adds it;
otherwise it updates it.  I think that's right ... but the SQL server's SQL
server is broken! (the irony!)

That won't solve all of your problems, but it might help.  Check up at
www.mysql.com on how to use "REPLACE"

"Monty" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have two tables: member_basic and member_detail. When a member edits
their
> record, they can edit or add data for either table, but, the data stored
in
> member_detail isn't required, so, they can possibly leave these fields
> blank. By the way, both tables would be linked by a member id.
>
> Here's my dilemma: If they do fill in any fields associated with
> member_detail, I have to first see whether or not there's an entry in the
> member_detail table already for that user (based on member id number). If
> not, I then have to check ALL the form fields associated with this table
to
> see if any data was actually entered so I know whether or not to create a
> new record for the member in member_detail. If there is already an entry
for
> that member in member_detail, then I can just do a standard UPDATE.
>
> Now maybe this is how it has to be done, but, I was hoping there might be
an
> easier way to do this. It appears it's not possible to UPDATE a JOINed
table
> during a query, which is what I was hoping. I am trying to keep the DB
> efficient by keeping optional data that may be left empty in another
table,
> but, it's only making my life difficult, so, unless there's an easier way,
I
> may just combine all the fields into one table and be done with it.
>
> Sorry for the long-winded explanation. Any suggestion are greatly
> appreciated!
>
> Monty
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to