Jump to content

Apagar uma nota (não funciona)


sEnte
 Share

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.