OK here's basically what I've done:
1. Uploaded csv file and opened it using fopen
2. Read entire contents into an array ($fileContent)
3. Use a variable to say how many fields should be required for each record going into the table (eg 4)
4. Loop through the $fileContent array and for each loop check to make sure it contains the correct amount of fields
5. If it contains correct amount then insert into mysql
6. If it doesn't then I want to implode it using "," as delimiter and put that as one record into an errors table for the user to review
My problem is that although the implode function does what I want it to do it still says Warning: implode(): Bad arguments. Why is this - the function is working but it still says this. I think it might have something to do with the fact that the array is multidimensional and I'm saying implode(",",$fileContent[$i]) where $i is the iteration of the loop (if that makes sense !!). But I can't say implode(",",$fileContent) because I only want that one "record" from the array to be imploded. If I use this it returns Array. But as I said, the way I'm doing it works just that it returns the warning also !!
Sorry if this sounds confusing - it's just that my code is quiet big so I wanted to avoid posting it if possible. I'd appreciate any help anybody can provide.
Thanks
1. Uploaded csv file and opened it using fopen
2. Read entire contents into an array ($fileContent)
3. Use a variable to say how many fields should be required for each record going into the table (eg 4)
4. Loop through the $fileContent array and for each loop check to make sure it contains the correct amount of fields
5. If it contains correct amount then insert into mysql
6. If it doesn't then I want to implode it using "," as delimiter and put that as one record into an errors table for the user to review
My problem is that although the implode function does what I want it to do it still says Warning: implode(): Bad arguments. Why is this - the function is working but it still says this. I think it might have something to do with the fact that the array is multidimensional and I'm saying implode(",",$fileContent[$i]) where $i is the iteration of the loop (if that makes sense !!). But I can't say implode(",",$fileContent) because I only want that one "record" from the array to be imploded. If I use this it returns Array. But as I said, the way I'm doing it works just that it returns the warning also !!
Sorry if this sounds confusing - it's just that my code is quiet big so I wanted to avoid posting it if possible. I'd appreciate any help anybody can provide.
Thanks