Posts

Showing posts from February, 2012

some important mysql function

1.  count() 2. max(); 3. in() ; 4. min(); 5. avg(); 6. sum(); 7.  date() 8. date different ()

JOIN Operation In MYSQL

LEFT JOIN Operation IN MYSQL 1. Select All row from Table Left (Table 1) even if there are no matches in the right table (table2). 2. select All Row from Right Table (Table2) who is match in left Table ; SELECT * FROM Table1 LEFT JOIN Table2 ON Table1.colName=Table2.colName RIGHT JOIN Operation IN MYSQL 1. Select All row from RIGHT Table (Table 2) even if there are no matches in the left table (table1). 2. select All Row from left Table (Table1) who is match in RIGHT Table ; SELECT * FROM Table1 RIGHT JOIN Table2 ON Table1.colName=Table2.colName FULL JOIN Operation IN MYSQL 1. Select All row from Both Table(Table1 , Table2) SELECT * FROM Table1 FULL JOIN Table2 ON Table1.colName=Table2.colName

what is unique key in mysql

unique  is key and its always unique,    that means no repeat  , unique is just like primary key but unique  may be NULL and primary key is not NULL how to create unique key in mysql table CREATE TABLE  tablename ( id  int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), UNIQUE (id) ) how to create unique key in mysql with multiple columns create unique key with combination of multiple column alter table  tbName  add unique index( column1 ,  column2 ,  column3 ,.....)

how to show all post in wordpress but not first

how to show all post of WordPress but not first  and all post is in descending order      <?php $p = 1 ;   query_posts ( $query_string  .  '&orderby=id&order=ASC' );  ?>           <?php  if ( have_posts ()) : while ( have_posts ()) :  the_post (); ?>       <?php $p ++ ;  if( $p == 2 ){ continue ; }  ?>       <h2 class="section_headline"> <?php the_title (); ?> </h2>             <?php    //the_excerpt ();   ?> <?php  the_content ();  ?>   

how to show category id or page id in wordpress

how to show categori id in wordpress how to show page id in WordPress  <?php  echo  $cat_id =  get_query_var ( ‘cat’ ) ;  ?> <?php  echo  $page_id =  get_query_var ( ‘page_id’ ) ;  ?>

show hide div using jquery , how to use show() , hide() function in jquery

Show Hide div using jquery click here for show div show hide div jquery example  Hi , I am Rajeev Dhar Dwivedi <script> function showdiv(){  $("#mydiv").show();    } function hidediv(){ $("#mydiv").hide() } </script> <div id="mydiv" style="display:none; background-color:#FF66CC; width:300px ; height:40px" > <b> Hi , I am Rajeev Dhar Dwivedi </b> </div> <input type="button" onclick="showdiv()" value="Show Div"  /> <input type="button" onclick="hidediv()" value="Hide Div"  />

how to use split() function in javascript

How to use Split() function in javascript String = Rajeev-Dhar-Dwivedi <script> function splitresult(){ var name = 'Rajeev-Dhar-Dwivedi' ; var val=name.split("-"); alert(val[0]); alert(val[1]); alert(val[2]); } </script> <b> String = Rajeev-Dhar-Dwivedi </b> <input type="button" onclick="splitresult()" value="Call Slipt Function"  /> for example you have a string Rajeev-Dhar-Dwived and you want to cut string every - seprator them use split() function in javascript split() function is just like to explote() function in PHP structer : var arrayval=string.split("seprator");   Example: var str = 'Rajeev-Dhar-Dwivedi' ; var val=name.split("-"); val[0]; // Rajeev val[1]; // Dhar val[2]; // Dwivedi

how to reload page using javascript

How to reload page using javascript <script> function reloadpage(){ window.location.reload() ; } </script> <input type="button" onclick="reloadpage()" value="Reload page"  />

how to add and remove class using jquery

Add Remove Class using jquery Name :  <script> function addcls(){  $("#name").attr("class","classname1 classname2");   } function removeclass(){ $("#name").removeAttr("class") } </script> Name : <input type="text" name="name" id="name" value="my name" onclick="(this.value='')" /><br /> <input type="button" onclick="addcls()" value="Add Class"  /> <input type="button" onclick="removeclass()" value="Remove Class"  />

how to show menu in wordpress

<?php wp_nav_menu( array('menu' => '22' )); ?> // 22 menu id

show one or more post in wordpress

show one or more WordPress post in header , index , or category page according to you         <?php        $args  = array(  'numberposts'  =>  1 ,  'order' =>  'ASC' ,  'orderby'  =>  'id' ,  'category'  =>  3  );         $postslist  =  get_posts (  $args  );        foreach ( $postslist  as  $post ) :   setup_postdata ( $post );  ?>        <?php the_content ();  ?>        <?php edit_post_link ( 'Edit' );  ?>        <?php  endforeach;  ?> numberposts = how many post ,...

show wordpress post in descriding order

    <?php query_posts($query_string . '&orderby=id&order=ASC'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post();?>     <div class="wrap_box">     <h2 class="section_headline"><?php the_title();?></h2>             <?php  the_content(); // the_excerpt ();  ?> <?php edit_post_link('Edit'); ?>         </div>     <?php endwhile; endif; ?>

Some Important Wordpress Function

Some Important Wordpress Function  <?php  the_content(); // get  content in wordpress ?> <?php the_excerpt (); //get part of content in wordpress ?> <?php the_title();  // get title of page and post  ?> <?php edit_post_link('Edit');  // edit link when wp-admin login ?> <?php bloginfo('home'); //http://localhost/myproject ?> <?php bloginfo('template_url'); //http://localhost/myproject/wp-content/themes/mythem  ?> <?php bloginfo('stylesheet_url'); //get style.css file from youe them ?> <?php bloginfo('name');  // name of your site  ?>  

How to Know user ( admin ) Login in wordpress site

     <?php if ( is_user_logged_in() ) {    echo ' user is loin ' ; } else {  echo ' Not Login ' ; } ?>

List of Post Category Wise in wordpress

for example show this type Category 1   post1    post 2    post3 category 2    post 1    post 2 Category 3   post1    post 2    post3  code : <?php // get all the categories from the database    $cats  =  get_categories (); // loop through the categries   foreach ( $cats  as  $cat ) {   // setup the cateogory ID    $cat_id =  $cat -> term_id ;   // Make a header for the cateogry    echo  "<h2>" . $cat -> name . "</h2>" ;   // create a custom wordpress query   query_posts ( "cat=$cat_id&post_per_page=100" );    // start the wordpre...

how to use wordpress

1. download WordPress from 

how to change string into date in mysql

how to change string into date in mysql //how to change string into date in mysql  str_to_date(string_data, format)   Example :       select *,floor(datediff('".date("Y-m-d")."',str_to_date('dob','%d-%m-%Y'))/365) as agediff from tablename       dob = column name  and varchar type 

Different between two date in javascript

calculating difference between two dates in java script <script> function changedays(x){  //df=$('#txtfdat').val();  //dt=$('#txttdate').val(); df='05-Jan-2012'; dt='10-Jan-2012';  d1=Date.parse(df);  d2=Date.parse(dt);     var one=1000*60*60*24       d3=d2-d1;    d4=d3/one;    alert(d4); } </script>

Different Between Two Date in PHP

<?php  // different between two date in php  function  dateDiff ( $start ,  $end ) {    // create your function here     $date1  =  strtotime ( $start );    $date2  =  strtotime ( $end );    $diff  =  $date2  -  $date1 ;   return  round ( $diff  /  86400 ); } echo  dateDiff ( "05-03-2012" ,  "13-03-2012" ). 'days' ; ?>

on click Enable and Disable check box on jquery

click   Show   Add   Edit   Delete   code :  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> function EnableCheckBox(x){ var classname = $(x).attr("class"); if($(x).attr("checked")){  $('.'+classname+'action').removeAttr("disabled");  } else { $('.'+classname+'action').removeAttr("checked"); $('.'+classname+'action').attr("disabled","true"); } } </script> <table>     <tr>  <td> click &nbsp; </td>  <td><input type="checkbox" name="subsection-click[]" value="show" class="click" onclick="EnableCheckBox(this);" /> Show &nbsp; </td>   <td> <input type="checkbox" name="subsection-click[]...

how to use .load() function

var url = "file.php"; $("#loaddata").load(url,{},function (responseText, textStatus, XMLHttpRequest) { alert(responseText);alert(textStatus);alert(XMLHttpRequest);   });  

how to know checkbox is checked in jquery

how to know checkbox is checked in javascript, Here we are provide a example similar to that    Select Check box code for this example : <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> function selectcheckbox(x){ var cls = $(x).attr('class'); if($('.'+cls).attr('checked')){ alert('chek box is checked'); } else { alert('check box is unchecked');} } </script> <form action="" method=""> <input type="checkbox"  name="checkboxname" value="checkboxvalue" class="checkboxcls"  onclick="selectcheckbox(this)"/> Select Check box </form>

how to use focus function javascript

 focu()  function  is use in javascript for focus of input box when you enter any wrong values in inputbox for example email , mobile number .. etc example : Email Id : when you enter wrong email them your cursor blink on input box  code : in javascript  document.getElementById('email').focus(); in jquery     $('#email').focus() ;    where email s id of input box

Email Validation In javascript

email validation in javascript or mail validation in javascript here we are provide a demo of email validation in javascript Email Id : code : <script> function emailvalidation(){     var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;     email = document.getElementById('email').value ;    if(emailPattern.test(email)==false){    alert('please Enter Valid Email Id');     document.getElementById('email').focus();     return false ;    }  }  </script>  <form >  <label> Email Id : </label>  <input type="text" name="email" value="please enter email id " id="email" onclick="(this.value='')"  />  <input type="submit" name="button" value="Chick Email" onclick="return emailvalidation()"  />  </form>

mobile number validation in javascript

mobile number validation is very important topic in javascript , we are try to say how to use mobile number validation in javascript , i think this is very useful for you thanks <script> function mobileNoValidation() { var mobile=parseInt(document.getElementById('mobile').value ); //var reg = /^([0-9]{10,10})$/; var reg = /^\d{10}$/; if(reg.test(mobile) == false) { alert('Please Enter Valid mobile number');  document.getElementById('mobile').focus(); return false; } } </script> <form action='#'> <input type="text" name="mobileNo" id="mobile" value="pease enter mobile no " maxlength="10" onClick="(this.value='')" onkeypress="return IsNumber(event , this);"  /> <input  type="submit" value="Submit"  onclick=" return  mobileNoValidation();" maxlength="12"  /> </fo...