PHP - CSV file overwriting based on UID -


I know I know what I have to do, a database with this would be better idea, but I do not want this database And the hassle of dealing with learning materials.

I have a CSV which is something like / 07/27 13: 26: 29, which is

  TestUser, 2010-07-27 13: 26: 0.0011,0,06,0.06 Testuser, 2010-07-27 14: 22: 12,2010 / 07/27 14: 22: 24,0.0033,0.0027.0.27 TestUser, 2010/07/7 14: 22: 41,2010 / 07/27 14: 22: 53,0.0033,0.0028,0.28 TestUser, 2010-07-27 14: 25: 26,2010 / 07/27 14: 25: 33,0.0019,0.0015, 0.30  

The second is the column which I am using as a unique id, so it will never happen in CSV. The PHP code used for writing in CSV is:

  $ myFile = "data.csv"; $ FH = FOPAN ($ myfile, 'a') or die ("can not open file"); $ String_data = $ _POST ["name"]. ",". $ _ POST ["Flight"]. ",". $ _ POST ["Date"] ".", ". $ _ POST [" Totalhour "].", "... $ _ Post [" Hour "]", "$ _ Post [" Payment "]" Fclose ($ FH);  

What should be done to do this, if there is someone who is on the same date (UID) With PHP, it would be overwritten above the same UID. Actually I am thinking that maybe with each line will have to go through a file array and then when it comes to a single pad of a UID If you reach it, then it will be blocked in return which was posted and whatever is not.

I am not sure if this is the best way to do what I want. Kindly agree with the ircmaxell (Learning to use a database), but you still deserve a reasonable response. Question.

I believe that you have to line up the line and compare No, it's not very efficient Yes, but your setup does not really allow for efficiency

"I'm not sure what I want, it's the best way to go about it." As IRMXCell suggested Using the database will be incredibly easy. Mysql is free and there is a piece of cake to take. As a bit simpler, it will be able to start the most in a few hours.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -