SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    delete from table hlp!

    hi!
    can someone tell me the right way to delete from the table?
    this is the script which wont work!
    PHP Code:
    <?php
    function delete_step1()
    {
    $blmargin $_POST["blmargin"]; 
    $btmargin $_POST["btmargin"]; 
    $bmwidth $_POST["bmwidth"]; 
    $bmheight $_POST["bmheight"];  
    $bgimage $_FILES['userfile']['name'];
    $input0 $_POST["input0"]; 
    $bff $_POST["bff"]; 
    $input1 $_POST["input1"]; 
    $bfs $_POST["bfs"]; 
    if(
    $_POST["blmargin"] !="")
      {    
    $ret "Delete blmargin, btmargin, bmwidth, bmheight, bgimage, input0, bff, input1, bfs from wt_style_design_body";
          
    $resultat mysql_query($ret);
        
    mysql_close($connect);
    echo 
    "<font color='#ff0000'>Data sucessfully deleted!</font><br>";
    } else {
    echo 
    "<font color='#ff0000'>Deleting data problems!</font><br>";  
    }}
    ?>
    any suggestion?
    thanx in advance!!!

  2. #2
    SitePoint Addict
    Join Date
    Jul 2002
    Location
    Sooner Nation
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No need to tell it to delete every column in the row - just use your unique ID and pass it and

    DELETE FROM wt_style_design_body where id = '$id'

    That will delete the row
    The only function of business is to create customer value and to innovate. - Peter Drucker

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,248
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    do you want to delete a row, or reset the mentioned fields to null?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes!
    i want reset the fields to null!!!

    suggestion!

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,248
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Code:
    update wt_style_design_body
       set blmargin = null
         , btmargin = null
         , bmwidth = null
         , bmheight = null
         , bgimage = null
         , input0 = null
         , bff = null
         , input1 = null
         , bfs = null
     where id = 937
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    Non-Member hyperimage's Avatar
    Join Date
    Dec 2003
    Location
    Croatia
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and for update the all table?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •