Posts

Showing posts from 2015

Change Date Format

<?php $date = "18/11/2015"; $change_date = str_replace('/', '-', $date); echo $result_date = date('Y-m-d', strtotime($change_date)); ?> //output: 2015-11-18

Remove index.php from config.php file using htaccess in Codeigniter

Image
- Make  .htaccess file and copy below code. - Put .htaccess file to codeigniter or your project folder. - For Ex.:   <IfModule mod_rewrite.c>   RewriteEngine On   #RewriteBase /   RewriteCond %{REQUEST_FILENAME} !-f   RewriteRule ^ index.php [QSA,L] </IfModule>

Solved JS Modal Problem of Stay Top

Put this code to bootstrap.js file //After this code if (!that.$element.parent().length) {         that.$element.appendTo(document.body) // don't move modals dom position       } // put this code /* ****************************** */         var offset = $(document).scrollTop();         // Get the window viewport height         var viewportHeight = $(window).height();         // cache your dialog element         var $myDialog = that.$element; //$('#cbf_scategory');         // now set your dialog position         $myDialog.css('top',  offset);     /* ****************************** */

Convert number to word in php

<?php function convert_number_to_words($number) { $hyphen = '-'; $conjunction = ' and '; $separator = ', '; $negative = 'negative '; $decimal = ' point '; $dictionary = array( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => &

Get Next Month Data in PHP

<?php //***************** Query ************ $query = "select * from test_table where date < date_sub(now(), interval 1 month)" ; $res_query = mysql_query($query); //*********** OUTPUT ************ int_id      name        date 1           Sandy     04-06-2015 2           Vandy    11-06-2015 3           Andy     18-06-2015 //******************************** ?>

Php Open Tag setting

Image
See the below image

Ajax Method in Jquery

<div dir="ltr" style="text-align: left;" trbidi="on"> <br /> <h1>Ajax Method in Jquery</h1> <pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivzH9V1GHFkK0q0bNtjJguqmg7i1bgxDsQWSCI9cnYgxNE7dA0bZvBWbqlA_dzq3nMzmWXOvoqdRA1U4Hg4pJHeN2PZAqEeWfX_tsXGN-03XK_CRONhL-dy46GIhewvLgeD2l0PhsYb8Mm/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> $(document).ready(function() { $("#from_station1").change(function(){ var city_id = $(this).val(); $.ajax({ method: "POST", url: "get_to_station.php?city_id=" + city_id, success:function(data) { $("#settostation").html(data); // data setting on

Online Currency Convertor

Online Currency Convertor In PHP <b>&lt;?php <br />$from = "USD";<br />$to = "INR";<br />$url = 'http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency='.$from.'&amp;ToCurrency='.$to;<br />$rate = simplexml_load_file($url);<br />echo 'Rate from '.$from.' to '.$to.' is: '.$rate[0];<br />?&gt; </b><br /> <br />

Only Show Current & Before Year

<select name="year" id='year' class="form-control"> <option value=""> Select </option> <?php $before = 0; // Specify number of "year" selections. $year = date('Y'); for( $i=4; $i>=$before; $i--) { $t = $year - $i; echo("<option value=\"$t\">$t</option>"); } ?> </select>

Get Data By Month and Year

<h2>Get Data By Month and Year</h2> <div dir="ltr" style="text-align: left;" trbidi="on"> <br /> function getLeave()<br />&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $this-&gt;db-&gt;where('MONTH(CURDATE()) = MONTH(emp_leave_start_date) and&nbsp; YEAR(CURDATE()) = YEAR(emp_leave_start_date)');<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $query = $this-&gt;db-&gt;get('employee_leave');<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return $query-&gt;result();<br />&nbsp;&nbsp;&nbsp; }</div>