How to run queries only once

Discussion in 'PHP' started by Little Honey, May 12, 2012.

  1. #1
    Hello,

    My index page includes a script that creates a database and fills it from .csv files in the home directory.

    How do I prevent the script from running more than once? I obviously only need the database created the very first time the program runs. I have tried include_once, but the tables still fills with duplicate data every time index.php is refreshed. What am I doing wrong? Never built a whole web app before so I'm going to have many more questions like this.

    Thanks!
     
    Little Honey, May 12, 2012 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Use msql commands to see if the database exists and then if the tables exist.
     
    sarahk, May 15, 2012 IP