I have to add the data from the table to the API.
Say for ex, if I have 1000 records
in my table how will I add the datas using chunks
. From the config file I should use the chunk size
.
My code looks something like this and I want to convert the array to a string
so I used implode
function.
public function addToList($data)
{
$numbers = [];
foreach ($data as $item)
{
$numbers[] = $item->value . ',id:' . $item->id . ',email:' . $item->email . ',name:' . $item->name;
}
$numbers = implode('|', $numbers);
}
How will I add chunks
to the above code ?
How to fetch the chunk
information from the config file and to implement it in the code.
$data is the data from the table
.
Could someone please help me? Thank you.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire