PHP Data Synchronization

Discussion in 'PHP' started by nes_jr429, Jun 12, 2013.

  1. #1
    Hello evryone, does anyone here have any idea about data synchronization using php?? when I import a csv file in my system, the site will automatically synchronize the data between the csv file and the live database.. Thanks.. :)
     
    nes_jr429, Jun 12, 2013 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    And what is your question?
     
    EricBruggema, Jun 12, 2013 IP
  3. nes_jr429

    nes_jr429 Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    My question is how could I make the all records between the live database and the csv file synchronized? Actually this is the scenario, when the user upload a csv file into the system, it will automatically synchronized the data between the database and the csv, so means there will be a per record comparison between the two. So for example if record A in the database is latest than the record A in the csv, it will not overwrite the record A on the database, but if record B in the database is outdated than record B in the csv, it will overwrite the record B on the database.. I'm not sure if I'm clear but let me know so I can explain it further more.. Thanks.
     
    nes_jr429, Jun 13, 2013 IP
  4. sorindsd

    sorindsd Well-Known Member

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    118
    #4
    You have to write a script that will parse the csv and the db and compare the rows.
     
    sorindsd, Jun 14, 2013 IP
  5. nes_jr429

    nes_jr429 Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #5
    that is the problem, I don't know how would I create the script for this, hehe.. can you help me?? thanks
     
    nes_jr429, Jun 16, 2013 IP
  6. sorindsd

    sorindsd Well-Known Member

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    118
    #6
    Take a look at this page http://php.net/manual/en/function.fgetcsv.php. Just parse the csv using that function and compare it with the db.
     
    sorindsd, Jun 17, 2013 IP
  7. nes_jr429

    nes_jr429 Member

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #7
    Ok I'll check this one.. thanks.. :)
     
    nes_jr429, Jun 17, 2013 IP