sEnte Posted August 31, 2014 Report Share Posted August 31, 2014 o meu "model" public function delete($id) { $this->db->delete('note', "`noteid` = {$data['noteid']} AND userid = '{$_SESSION['userid']}'"); } View <?php foreach ($this->noteList as $key => $value) { echo '<tr>'; echo '<td>' . $value['title'] . '</td>'; echo '<td>' . $value['date_added'] . '</td>'; echo '<td><a href="'. URL . 'note/edit/' . $value['noteid'].'">Edit</a></td>'; echo '<td><a class="delete" href="'. URL . 'note/delete/' . $value['noteid'].'">Delete</a></td>'; echo '</tr>'; } ?> controller public function delete($id) { $this->model->delete($id); header('location: ' . URL . 'note'); } para não estar a escrever tudo apenas copiei do escrito para os utilizadores para as notas. Nos utilizadores funciona tudo perfeitamente mas para as notas não :s Não me apaga a nota. "If It Ain't Broke, Break it and build something Cooler!" Unknown Link to comment Share on other sites More sharing options...
KTachyon Posted August 31, 2014 Report Share Posted August 31, 2014 O parametro $id não é utilizado na chamada à db. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare Link to comment Share on other sites More sharing options...
sEnte Posted September 1, 2014 Author Report Share Posted September 1, 2014 Se eu tirar a parte de redirecionar aparece Notice: Undefined variable: data in .../models/note_model.php on line 43 vou investigar. "If It Ain't Broke, Break it and build something Cooler!" Unknown Link to comment Share on other sites More sharing options...
KTachyon Posted September 1, 2014 Report Share Posted September 1, 2014 Porque devias estar a usar o $id e não o $data. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now