Problems deleting table data with :: PDO

0

Can anyone explain to me what the error is or if there is any flaw in the script ??

As far as I know this is correct, it does not work. In the script it takes the ID of who followed and the ID of who was followed and should remove by the parameters WHERE of the line MYSQL , but it is not deleting ..

// SISTEMA DE FOLLOW::USERS
    if(isset($_POST['action']) && $_POST['action'] == 'func_follow') {
        $method     = $_POST['method'];
        $id_de  = $_POST['id_de'];
        $id_para    = $_POST['id_para'];
        $f_data     = time();

        if($method == 'remove'){
            $busca_dados_s = $pdo->prepare("SELECT * FROM 'lc_follow' WHERE 'f_de' = ? AND 'f_para' = ?");
            $busca_dados_s->execute(array($id_de, $id_para));
            if($busca_dados_s->rowCount() > 0){
                $lc_unfollow_dados = $pdo->prepare("DELETE FROM 'lc_follow' WHERE 'f_de'=:f_de AND 'f_para'=:f_para)");
                $lc_unfollow_dados->bindValue(":f_de",$id_de);
                $lc_unfollow_dados->bindValue(":f_para",$id_para);
                $lc_unfollow_dados->execute();

                if($lc_unfollow_dados){
                    echo    '<div class="but_add" onclick="functionAjax_follow(\''.$id_de.'\', \''.$id_para.'\',\'add\')">
                                Seguir
                            </div>';
                } else {
                    echo '::ERRO::';
                }
            }
        }
    }
    
asked by anonymous 10.02.2016 / 14:13

1 answer

0

When using prepared statements it is not necessary to escape values with single quotation marks:

DELETE FROM 'lc_follow' WHERE 'f_de'=':f_de' AND 'f_para'=':f_para'
   ----------------------------------^     ^              ^       ^ 
    
10.02.2016 / 14:23