Wednesday, June 12, 2013

Count days between two days (allies-: age calC)

<?php

$startTimeStamp = strtotime("2012/06/12");
$endTimeStamp = strtotime("2014/07/12");
$timeDiff = abs($endTimeStamp - $startTimeStamp);
$numberDays = $timeDiff/86400;  // 86400 seconds in one day
// and you might want to convert to integer
$numberDays = intval($numberDays);
if($numberDays>=365)
{
$get_year=round(($numberDays/365),0);
$remain_days=$numberDays-(365*$get_year);

if($remain_days>=30)
{
$get_mnth=round(($remain_days/30),0);
$get_remain_days=$remain_days-(30*$get_mnth);
$final_date=$get_year.' years '.$get_mnth.' Month '.$get_remain_days.' Days';
}

}
if($numberDays<365 && $numberDays>=30)
{
$get_mnth=round(($numberDays/30),0);
$find_days=$numberDays-(30*$get_mnth);
$final_date=$get_mnth.' month '.$find_days." days";
}
if($numberDays<30)
{
$final_date=$numberDays .' Days';
}

echo $final_date;

?>

Thursday, May 23, 2013

left join


select a.id,b.phone
from a
right join b
on a.id=b.emp_id

where a and b is table

Monday, May 20, 2013

upload server image in local disk using php



<?php
function img_url()
{

$num=rand(1,99999999999999999999)-rand(5000,8585858571);
$urls=$_SERVER['REMOTE_ADDR'];
$ip=$_SERVER['HTTP_HOST'];

$filename=$num."_".$urls;
$img = 'img/'.$filename.'.jpg';
file_put_contents($img, file_get_contents($url));
$file_location='http://www.'.$ip.'/'.$img;

//echo $file_location;

//echo '<img src="'.$file_location.'" height="auto" width="auto" style="border:0px solid green" />';
echo '
<img src="'.$url.'" />
';
}

img_url();

?>

Thursday, April 4, 2013

my others blogs

data fetching while scrolling just like facebook


<script language="javascript" src="http://www.infoonnet.com/js/jquery.js"></script>
<script>
$(document).scroll(function(){
    if ($(window).scrollTop() + $(window).height() == $(document).height())
{
       document.getElementById("a").innerHTML+='<div style="height:100%; border:1px solid red" id="a">pag1 1</div>';
    }
});
</script>



<div style="height:100%; border:1px solid red" id="a">
pag1 1
</div>
<div style="height:100%; border:1px solid red" id="b">
pag1 1
</div>