trying to delete rows but not working.

Discussion in 'PHP' started by baris22, Nov 12, 2008.

  1. #1
    hello,

    I was using this code to edit the rows. it was working perfect

    
    
    if($Submit){
    for($i=0;$i<$count;$i++){
    $sql1="UPDATE $tbl_name SET title='$title[$i]', description='$description[$i]' WHERE id='$id[$i]'";
    $result1=mysql_query($sql1);
    }
    }
    if($result1){
    echo "<meta http-equiv=\"refresh\" content=\"0\">";
    }
    
    mysql_close();
    ?>
    
    
    PHP:
    I added delete function.but it is not working. it is keep refresing the page.

    
    
    if($Submit){
    for($i=0;$i<$count;$i++){
    $sql1="UPDATE $tbl_name SET title='$title[$i]', description='$description[$i]' WHERE id='$id[$i]'";
    $result1=mysql_query($sql1);
    }
    }
    if($result1){
    echo "<meta http-equiv=\"refresh\" content=\"0\">";
    }
    
    if($delete){
    for($i=0;$i<$count;$i++){
    $del_id = $checkbox[$i];
    $sql = "DELETE FROM $tbl_name WHERE id='$del_id'";
    $result = mysql_query($sql);
    }
    }
    if($result){
    echo "<meta http-equiv=\"refresh\" content=\"0\">";
    }
    mysql_close();
    ?>
    
    
    PHP:
    where am i doing wrong?

    if i remove

    
    
    echo "<meta http-equiv=\"refresh\" content=\"0\">";
    
    
    PHP:
    it works but i need to put the internet explorer off and on again to see theresult.
     
    baris22, Nov 12, 2008 IP
  2. logondotinfo

    logondotinfo Peon

    Messages:
    314
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    instead of:
    echo "<meta http-equiv=\"refresh\" content=\"0\">";
    Code (markup):
    try
    header('Location: http://yoursite.com/originalpage.php'); 
    Code (markup):
    NOTE: This will only work provided it is written BEFORE any html in your file (form handlers should be above the html anyway!)
     
    logondotinfo, Nov 12, 2008 IP