How to create a new branch git

How create a new branch git

create a new branch git

#git checkout -b BRANCH_NAME

Here is conman git command
STEP 1 : clone

# git clone --single-branch -b BRANCH_NAME  https://github.com/**************.com.git

STEP 2: Config

# git config push.default upstream

STEP 3: Check out

#git checkout BRANCH_NAME

STEP 4: Do the changes and add

 
#git add .

STEP 5: Commit the changes

#git commit -m "home page change"

STEP 6: Finally

#git push origin BRANCH_NAME

You almost done

JQuery code to append html using div id

Here am going to show you JQuery code to append html using div id
suppose i have html code like below i need append a text content to the html area when user entering any text

 

<input type="text" value="" id="inputarea">

<div id="html_area">

</div>

 

$(document).ready(function(){
$("#inputarea").blur(function(){
  $("#html_areap").append("<b>User Is typing a text</b>");
});
});

PHP code to find the current year,current month and current day

PHP have date function get all the information related to date here we have to search find out PHP code to find the current year,current month and current day , current year,current month and current day can be easily find out using date() function let me check how to do it

php code to find current year


<?php

echo date('Y');  //Capital Letter Y

Out Put

2019

?>

<?php

echo date('y');  //Small letter y

Out Put

19

?>

php code to find current month


<?php

 echo date('M');  

Out Put

Jul

?>

<?php

 echo date('m');  

Out Put

07

?>

php code to find current day

 


<?php

 echo date('D');  

Out Put

Mon

?>

<?php

 echo date('d');  

Out Put

08

?>

php try catch exception handling code with example

Here we are trying to find out how to add php try catch exception handling code in your PHP .we know that like every programming language php also as its on error handling method, Exception handling in PHP ,new object oriented way of dealing with errors, we have have PHP try catch exception handling code
Here is the syntax

//trigger exception in a "try" block
try {

}
//catch exception
catch(Exception $e) {
  echo 'Error: ' .$e->getMessage();
}

See PHP try catch exception handling code with example


try {
          $status = 1;

            $cont = $this->conn;
            $sql = "INSERTED INTO menu(display_name, menu_link,  status,sort_order,menu_slug) VALUES(:menu_title,:menu_link,:status,:sort_order,:menu_slug)";
            $new_db = $cont->prepare($sql);

            $new_db->bindParam(':menu_title', $data['menu_title']);
            $new_db->bindParam(':menu_link', $data['menu_link']);

            $new_db->bindParam(':sort_order', $data['sort_order']);
            $new_db->bindParam(':status', $status);
            if($data['menu_slug']!='')
            {
                $slug_value=$data['menu_slug'];
            }
            else
            {
                $slug_value=$data['menu_title'];
            }
            $slug = $this->generate_sub_menu_slug($extra_string='',$slug_value);
            $new_db->bindParam(':menu_slug', $slug);


            $new_db->execute();
        } catch (PDOException $e) {
            echo "Error: " . $e->getMessage();
        }

In the above example MySQL INSERT syntax is wrong so this php code through an Exception error that says SQL state error

 try { 
          $status = 1;

            $cont = $this->conn;
            $sql = "INSERT INTO menu(display_name, menu_link,  status,sort_order,menu_slug) VALUES(:menu_title,:menu_link,:status,:sort_order,:menu_slug)";
            $new_db = $cont->prepare($sql);

            $new_db->bindParam(':menu_title', $data['menu_title']);
            $new_db->bindParam(':menu_link', $data['menu_link']);

            $new_db->bindParam(':sort_order', $data['sort_order']);
            $new_db->bindParam(':status', $status);
            if($data['menu_slug']!='')
            {
                $slug_value=$data['menu_slug'];
            }
            else
            {
                $slug_value=$data['menu_title'];
            }
            $slug = $this->generate_sub_menu_slug($extra_string='',$slug_value);
            $new_db->bindParam(':menu_slug', $slug);


            $new_db->execute();
        } catch (PDOException $e) {
            echo "Error: " . $e->getMessage();
        }