Change ownership of file or folder in Linux [Ubuntu]

change ownership of file or folder in Linux [Ubuntu]

open terminal-

if you are not logged in as root then type bellow command to change file or folder ownership:

first you need to login as root:

type su -> enter -> type pw

now you are logged in as root.

go to near that folder or file you want to change ownership and type:

chown -R username folder/file name or * to change all

Multiple rows insert in WordPress

----------------------------------------------------
$items         = [];
$values        = [];
$place_holders = [];
$query         = "INSERT INTO {$wpdb->prefix}table_name (col1, col2) VALUES ";
foreach ( $your_data_array_here as $key => $val ) {
    array_push( $values, $col1_value );
    array_push( $values, $col2_value );
    $place_holders[] = "('%d', '%d')";
}

$query .= implode( ', ', $place_holders );
$wpdb->query( $wpdb->prepare( "$query ", $values ) );

------------------------------------------------------
//set your key and data as per your needs.

Php mysql recursive function to delete all child nodes in one table

// first action:

// find the deepest nodes if have any

   $child_kit = [ ];
   get_child_dir_ids( $fd_id, $child_kit );

   $wpdb->delete(
       $wpdb->prefix . 'table_A',
           array( 'dir_id' => $fd_id, 'eid' => $eid ),
           array( '%d', '%d' )
   );
   $wpdb->delete(
       $wpdb->prefix . 'table_A',
           array( 'parent_id' => $fd_id, 'eid' => $eid ),
           array( '%d', '%d' )
   );

   //delete all child nodes now

   if ( count($child_kit) > 0 ) {
       $dir_id_to_be_deleted = implode( ",", $child_kit );
       $query = "DELETE FROM {$wpdb->prefix}table_A WHERE eid={$eid} AND parent_id IN($dir_id_to_be_deleted)";
       $wpdb->query($query);
   }

// second action:

function get_child_dir_ids( $parent_id, &$child_kit ) {
    global $wpdb;

    $query  = "SELECT dir_id FROM {$wpdb->prefix}table_A WHERE parent_id=" . $parent_id;
    $dir_id = $wpdb->get_var( $query );
    if ( is_null( $dir_id ) ) {
        return $child_kit;
    } else {
        $child_kit[] = $dir_id;
        get_child_dir_ids( $dir_id, $child_kit );
    }

}

*** i have shown it in wordpress way but you can manage it in any programming language or platform you like********************************************************

Pure CSS Menu

HTML:
---------
<ul class="drop_menu">
 <li><a href='/'>Home</a></li>
 <li><a href='#'>Location</a>
  <ul class="drop_menu_level_1">
   <li>
    <a href='#'>Sub Link 1</a>
    <ul class="subsubmenu">
     <li><a href='#'>Sub sub Link 1</a></li>
     <li><a href='#'>Sub sub Link 2</a></li>
    </ul>
   </li>
   <li><a href='#'>Sub Link 2</a></li>
   <li>
    <a href='#'>Sub Link 3</a>
    <ul class="subsubmenu">
     <li><a href='#'>Sub sub Link 1</a></li>
     <li><a href='#'>Sub sub Link 2</a></li>
    </ul>
   </li>
  </ul>
 </li>
 <li><a href=''>Page 1</a></li>
 <li><a href=''>Page 2</a></li>
 <li><a href=''>Page 3</a></li>
</ul>
******************************************************************
css:
-----
/*ashique_menu*/
.drop_menu {
 background:#006699;
 padding:0;
 margin:0;
 list-style-type:none;
 height:auto;
 float: left;
 width: 100%;
}
.drop_menu li { float:left; }
.drop_menu li a {
 padding:9px 20px;
 display:block;
 color:#fff;
 text-decoration:none;
 font:12px arial, verdana, sans-serif;
}


/* Submenu */
.drop_menu ul.drop_menu_level_1 {
 position:absolute;
 left:-9999px;
 top:-9999px;
 list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#aa1d05; }
.drop_menu li:hover ul.drop_menu_level_1 {
 left:0px;
 top:30px;
 background:#aa1d05;
 padding:0px;
}


.drop_menu li:hover ul.drop_menu_level_1 li a {
 padding:5px;
 display:block;
 width:168px;
 text-indent:15px;
 background-color:#aa1d05;
}
.drop_menu li:hover ul.drop_menu_level_1 li a:hover { background:#005555; }
/*sub sub menu*/
.drop_menu li ul.drop_menu_level_1 li ul.subsubmenu {
 position:absolute;
 left:-9999px;
 top:-9999px;
 list-style-type:none;
 display: none;
}
.drop_menu li ul.drop_menu_level_1 li:hover { position:relative; background:#aa1d05; }
.drop_menu li ul.drop_menu_level_1 li:hover ul.subsubmenu {
 left: 168px;
 top:0px;
 background:#aa1d05;
 padding:0px;
 display:block;
}