SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Insert in to

  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    Milan, Italy
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Insert in to

    Hello everyone..

    Here is the result of my Insert. and also the insert works ok.

    Code:
    INSERT INTO MOD48_02 (ID, TE_INDI, TE_COGNOME, TE_NOME, TE_SESSO, TE_ATTNASC, TE_LUONASC, TE_DTNASC, TE_PROVSTATO, TE_PROV, TE_PATERNITA, TE_RICHIESTA, USERNAME, DATE_INSERTED, TIME_INSERTED) VALUES ('127001200745101033', 'england', 'bloom', 'orlando', 'M', 'ww', 'florida', '05/06/1984', 'america', 'UK', 'xx', 'no', 'demo', '05/04/2007', '10.10.33');
    But before i insert this record i want to check if the it hasn't been inserted before. I want to use the following fields as the riefferent. TE_COGNOME, TE_NOME, TE_SESSO, TE_DTNASC

    And if there is no record to match those 4 fields i want to insert it else just a message saying that the record has been inserted b4.

    any idea to start with?
    dReAm

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,534
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Simple way is to run a SELECT query against those fields/values - if no results returned (i.e. recordset.EOF) then do the INSERT query.
    Ian Anderson
    www.siteguru.co.uk

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
  •