SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would I go about combining these commands to update a record if it already exists, or insert it if it doesn't?
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  2. #2
    SitePoint Enthusiast poil11's Avatar
    Join Date
    Aug 2000
    Location
    it look me along time to do that...
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you will have to do them one after each other. you won't be able to combine them. you will have to query the databse and see if the record or whatever you want to insert exists. if there is a duplicate then do nothing. if the record or whatever doesn't exist then do an insert command. sounds compicated even to me reading it, if you need more help say so.
    I will Tell you what is wrong with your website and maybe what you can do to make it better.
    Professional Web Site Reviews ... Usability ...
    Contact Me god@stillsucks.com for more information ...
    look at my other reviews, to see what i have done.

  3. #3
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From memory mysql has a replace function, does it not??

    Works something like
    REPLACE INTO table_name SET column1='value1', column2='value2' WHERE id='whatever'

    You can probabaly see how it works, if i have made a mistake with the sql can someone point it out...i am not 100% sure of the replace syntax

    <EDIT>That syntax is correct, just checked the manual</EDIT>
    Last edited by mad-onion; Feb 18, 2001 at 01:15.
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •