Below is my code for deleting all rows with ids one.It seems that only first index was deleted and an error will trigger right away.How can i loop through the array and delete all rows with id one. The array I've created here is only a representation from my database with multiple columns. Any idea in resolving this problem is much appreciated.
public function deleteRow(){
$ids = ['1','1','1','3','3','1','1'];
foreach($ids as $id ){
$id = Scholarshipcount::find($id);
$id->delete();
}
}
my error
Call to a member function delete() on a non-object
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire