File_put_contents writes only half of the data

Asked

Viewed 24 times

0

So I’m having a little problem with my code, query, for, foreach and if work perfectly. However, file_put_contents only writes half of the reported data. My goal with this code is basically to make a query of the bank, return the result and in array to be converted into json and be divided by the 'assembler_idmontadora' with the vehicle models corresponding to each automaker. Down with the Code I’m trying to make :

inserir a descrição da imagem aqui

My Class:

inserir a descrição da imagem aqui

And finally my crud job:

inserir a descrição da imagem aqui

  • This may be happening because the foreach is passing more than once with the same counter $i. (As I don’t know your logic, it seems to me this). You can also use this way: file_put_contents(file, data, FILE_APPEND); to add, rather than replace the content.

  • Hello @Henrique. Avoid placing images of your code, instead edit your question and place the structured code there.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.