PHP csv file lookup assistance -


One of our company's websites has a page that reads the CSV file and depends on the serial number input. , Gives a list of manuals for that part, currently there are only two columns in the CSV file, for a serial number, the same part of the folder for the second part matches the same named PDF. We have recently moved to sage 200 and have a new list of part numbers (for existing parts) and want to add a third column with these new part codes.

I inherited this site and knew very little PHP, if anybody thought that you can tell me in the right direction :)

I can find on the page Code:

  $ $ serial = $ _POST ['serialobox']; Echo "You searched for serial $ serial"; $ File = nl2br (file_get_contents ("./tkmanuals / serialnos.csv")); If ($ strposition = strpos ($ file, "$ serial")) {$ strposition = $ strposition + 7; $ Br = Straps (substrate ($ file, "$ stripship", "50"), ""); $ Tspart = substr ($ file, "$ strposition", "$ br"); $ Tspart = trim ($ tspart); Echo "This track system is: $ tspart."; } Else {echo "Search for you: $ serial again.   

Any help or points will be highly appreciated.

If there is no option to go to a database, the following php code (taken from example 1) can give you the beginnings:

  @ $ serial = $ _POST [ 'serialnobox']; $ row = 1; if (($ $ handle = fopen ( ". / Tkmanuals / serialnos.csv", "r")) == Wrong) {while ($ data = fgetcsv ($ handle, 1000, ","))! == incorrect) {if ($ data [0] == "$ dirv Hick ") {echo" resound first number $ data [1] and the second number is $ data [2] & lt; Br> ";}} Fclose ($ handle);}   

If you would like to manage them I If your code serial number is a string - in which case you should use string comparison , And not == to check the serial number in the first column data [0]. .

I used to create a database for my The recommendation will repeat; You can create a simple user interface for CAD Industries. Add parts and part numbers / NO Inner (in other words - "hide" the fact that this user has a database). You want to end with a single copy of the information (plus backup) which is an important step in data integrity: When you have more than one copy of the information, they will exit the sync ...

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -