Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions application/core/modelo2.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ function update ($table, $params){
$query->execute($array_parameters);
}

function delete ($table, $params = null, $entity = false){
if($params != null){
$sql = "DELETE FROM $table WHERE id = :".$params[0];
//eliminado parametro $entity de momento
function delete ($table, $song_id = 0){
if($song_id != 0){
$sql = "DELETE FROM $table WHERE id = ".$song_id;
//d($sql);
$query = $this->db->prepare($sql);
$clave = ":id";
$valor = $params[0];
$valor = $song_id;
//d($valor);
$parameters = array();
$parameters[$clave] = $valor;
Expand Down
4 changes: 2 additions & 2 deletions application/modulos/songs/Csongs.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public function deleteSong_action($song_id){
if (isset($song_id)) {
// do deleteSong() in model/model.php
$this->model->deleteSong("song",$song_id);
}
}

// where to go after song has been deleted
// redirect user to songs index page (as we don't have a song_id)
header('location: ' . URL . 'songs/index');
}

Expand Down
4 changes: 2 additions & 2 deletions application/modulos/songs/Msongs.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function addSong($table, $params) {
* add/update/delete stuff!
* @param int $song_id Id of song
*/
public function deleteSong($table, $song_id, $entity = null){
public function deleteSong($table, $song_id){
echo "Hola desde deleteSong";
$this->delete($table, $song_id, $entity);
$this->delete($table, $song_id);
}

/**
Expand Down