Web Analytics Made Easy -
StatCounter delete query question - CodingForum

Announcement

Collapse
No announcement yet.

delete query question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • delete query question

    hi, i have a problem with a DELETE query that does not works.
    i have a page in php where appears a table with some info ex. id,program name,details and the link to download the program.
    in that same page there is a little form where i enter the program id and click on the submit button where the id is sent to another php page where validates and runs the delete query. my problem is that there is no error but the query does not delete the program row with the correspond id. this is the php page where should delete the row according to the entered id in the previous page:

    Code:
    <?php
    include("funciones.php");
    conectar();
    
    $idprog = $_POST["idprog"];
    
    $sqlquery1 = "SELECT * FROM programas WHERE idprog = '".$idprog."' ";
    $query1 = mysql_query($sqlquery1) or die ("El query no se ejecuto. <a href=adminaction.php>Regresar</a>");
    
    if (!empty($query1))
    {
    $sqlquery2 = "DELETE FROM programas WHERE idprog = '".$idprog."' ";
    header("Location: adminaction.php");
    }
    else
    {
    die("No hubo resultados. <a href=adminaction.php>Regresar<a/>");
    }
    ?>

  • #2
    I don't see you executing the query. Like

    PHP Code:
    ....
    $sqlquery2 "DELETE FROM programas WHERE idprog = '".$idprog."' ";
    $resultdel mysql_query($sqlquery2) .... ;
    .... 
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment


    • #3
      jajaj, thanks now runs well

      Comment

      Working...
      X