hi all good people in this forum.

i have a table called mc_blocks
in one of the rows called "LBData" is this" NewProducts:Search:Information:"
without ""

The code to delele the value is this :

<a href=processConfig.php?action=deleteblock&xdpLBData=".$checkL.":>Delete</a>

As an example : output of this will be
processConfig.php?action=deleteblock&xdpLBData=Information:

Inside of my processConfig.php i have this function


function deleteBlock()
  {


    $lb=($_GET['xdpLBData']);

     // debuging pupose
    //echo "$lb";

    $sql = "DELETE FROM ".PREFIX."mc_blocks WHERE LBData='".$lb."'";
   $result =&dbQuery($sql);
   header('Location: index.php');


 }

Why this doesnt want to delete value from $GET method?
row called "LBData"" NewProducts:Search:Information:"

Last value" Information:" should be removed
When i do echo right data is there.

Thank you,

    First, your WHERE operator is "=" which demands an exact match. If you need to find a sub-portion of text use the "LIKE" operator and SQL text wild cards. Refer to your database servers documentation for details.

    The bigger problem is DELETE deletes the whole row. It sounds like you only want to remove a portion of the LBData field. This would require reading the current field, modifying it to remove the desired data, and then UPDATING the row writing back the new value for LBData.

      thank you for your help.
      this solved my problem !

      
      function deleteBlock()
      {
              $sql="SELECT LBData ,RBData FROM ".PREFIX."mc_blocks";
              $result =&dbQuery($sql) or die(mysql_error());
              while ($row =& dbFetchAssoc($result)) {
      	extract($row);
      
            $LBData= $row['LBData'];
            $RBData= $row['RBData'];
      
            $lb=($_GET['xdpLBData']);
            $rb=($_GET['xdpRBData']);
      
      
      
        $LBData=str_replace(array($lb), "", $LBData);
        $RBData=str_replace(array($rb), "", $RBData);
      
        $sql ="UPDATE ".PREFIX."mc_blocks SET LBData = '$LBData',RBData = '$RBData'";
            dbQuery($sql) or die(mysql_error());
        	  header('Location: index.php');
      
      
      }
       }
      
      
        Write a Reply...