DELETE FROM is not working (mysql)

What my code makes is, if the state of a project is finalised, deletes the project from a table and inserts it to another table by picking up the reference. Maybe here is the problem, the reference is like this: ST9999_15 or ST8888_15. Maybe the underscore is the problem:

if ($state="Finalised") {
    $result=mysqli_query($con,"SELECT * FROM `proyectos_en_curso` WHERE `referencia`='$reference'");
    $row = mysqli_fetch_array($result);
    $name=$row['name'];
    $ling_comb=$row['combinacion_linguistica'];
    $date=$row['fecha_entrega_cliente'];
    mysqli_query($con,"DELETE FROM `proyectos_en_curso` WHERE `referencia`='ST9999_15'");
    mysqli_query($con,"INSERT INTO `proyectos_entregados` 
    (`name`, `referencia`, `combinacion_linguistica`, `fecha_entrega_cliente`) 
    VALUES ('$name', '$reference', 
    '$ling_comb', '$date')");
}
mysqli_close($con);

Thank you so much for your help.


Source: mysql

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.