S
S
Stepan2015-02-05 14:54:33
Yii
Stepan, 2015-02-05 14:54:33

Yii2 - How to delete one record?

I upload pictures and output them like this

<? foreach($allPhoto as $ph): ?>
 <div class="bg-danger">
   <img style="width: 200px;" src="<?= '.$ph['photo']?>" alt=""/>
        <span><?= $ph['author'] ?></span>
        <span style="float: right"><?= $ph['time'] ?></span>
 </div>
 <br/>
<? endforeach ;?

You need to add a button that will delete one of the uploaded photos. It doesn't work at all.
How to do it there and what should the controller look like?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Grechushnikov, 2015-02-05
@maxyc_webber

you make a link to the controller and its action. pass it the ID of the photo. you delete it in the action, you transfer it to the same page from where you came.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question