healthy
04-06-2008, 08:27 PM
I have a client whose system continously uploads to a directory on a webserver a txt file with the data of a table that needs to be fed every day with sales reports for each day so that the txt file is updated, (that is the txt file it's replaced dayly for its new version, keeping the same name for the txt file) hence, the txt file changes every day, but the info of previous days must be kept on a mysql data base, having the information for each day whilst the txt file only has the info for one particular instance, for the particular day we be on, so the information of the rest of the previous days will not be at the txt file but will be saved at the mysql data
how do I do this who is the genious who can tell me this??????
I have this idea: the txt file is: "report.txt", the table is "tablereports", the phpfile name is: "solution.php", which has this code :
<?
// we conect to our data base (say reportsdb) and all that (I know how to do this,
//I guess) , then we do this:
$sql = "LOAD DATA LOCAL INFILE report.txt INTO TABLE tablereports"
//or is it:
//$sql = "LOAD DATA LOCAL INFILE "report.txt" INTO TABLE tablereports"
//???????
//then I add code to show results and all that (I know how to do this, I guess)
>
is this correct?
do I have to add the path to the file before the name, if the php file,"solution.php", and the txt file, "report.txt", are in the same directories?
and, then to always have the table updated:
HOW CAN I RUN THE SCRIPT LIKE SAY ONCE EVERY DAY OR ONCE EVERY DAY, WITH OUT HAVING THE CLIENT RUNNING "solutions.php" ,
SO I CAN UPDATE the table AUTOMATICALLY every day?
.
.
.
.
.
.
.
.
how do I do this who is the genious who can tell me this??????
I have this idea: the txt file is: "report.txt", the table is "tablereports", the phpfile name is: "solution.php", which has this code :
<?
// we conect to our data base (say reportsdb) and all that (I know how to do this,
//I guess) , then we do this:
$sql = "LOAD DATA LOCAL INFILE report.txt INTO TABLE tablereports"
//or is it:
//$sql = "LOAD DATA LOCAL INFILE "report.txt" INTO TABLE tablereports"
//???????
//then I add code to show results and all that (I know how to do this, I guess)
>
is this correct?
do I have to add the path to the file before the name, if the php file,"solution.php", and the txt file, "report.txt", are in the same directories?
and, then to always have the table updated:
HOW CAN I RUN THE SCRIPT LIKE SAY ONCE EVERY DAY OR ONCE EVERY DAY, WITH OUT HAVING THE CLIENT RUNNING "solutions.php" ,
SO I CAN UPDATE the table AUTOMATICALLY every day?
.
.
.
.
.
.
.
.
