Showing posts with label How to. Show all posts
Showing posts with label How to. Show all posts

Thursday, 11 February 2016



you can use this code in the following cases:

1) if you want to save data on submitting form then,
replace onchange=“getSummary2(‘order’)” with onclick=“getSummary2(‘order’)”

2) if you want to save on key up then,
replace onchange=“getSummary2(‘order’)” with onKeyUp=“getSummary2(‘order’)”

3) if you want to save data on change then use the code as it is


---------------------------------------------html code-------------------------------------------------


----------------------------------------------------------------------------------------------------------
------------------------------------------javascript.js--------------------------------------------------
function getSummary2(pass)
{
var	id = document.getElementById("sp_order"+pass).value;
	//alert(pass);
   $.ajax({
     type: "GET",
     url: 'sp_orders.php',
     data: "order=" + id + "&&section_id=" + pass, 
// appears as $_GET['id'] @ your backend side
     success: function(data) {
           // data is ur summary
        //  $('#order').html(data);
		     }

   });

}

-------------------------------------------------------------------------------------------------------------
-----------------------------------------sp_orders.php---------------------------------------------------
include('connect.php');
 $timestamp_complete = date("Y-m-d");
 $order = $_GET['order'];
 $section_id = $_GET['section_id'];
 mysql_query(" UPDATE  d_o_sp_orders  SET status='0' 
WHERE section_id='$section_id'");
		
mysql_query(" INSERT INTO  table (`order_id`, `orders`,
 `section_id`, `status`, `status_timestamp`) VALUES 
(NULL, ' $order', '$section_id', '1', '$timestamp_complete')");

------------------------------------------------------------------------------------------------------------
                                                   

Saturday, 8 February 2014

Convert an address to its Long, Lat:

First 23 lines of code will convert your address to its latitude and longitude.

Convert Long, Lat to its according Address:

Lines from 24 to 43 of below code will convert your  latitude and longitude its address.

Calculate Distance /between two Long, Lat:

Lines from 87 to onward of below code will calculate the distance between two given addressess.

NOTE: In case of any error, feel free to ask in comments.

1:  <?php  
2:  $postcode1 = urlencode("bb9 5sh"); // post code to look up in this case status however can easily be retrieved from a database or a form post  
3:    $request_url1 = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$postcode1."&sensor=true"; // the request URL you'll send to google to get back your XML feed  
4:    $xml1 = simplexml_load_file($request_url1) or die("url not loading");// XML request  
5:    $status1 = $xml1->status;// GET the request status as google's api can return several responses  
6:    if ($status1=="OK") {  
7:      //request returned completed time to get lat / lang for storage  
8:      $lat1 = $xml1->result->geometry->location->lat;  
9:      $long1 = $xml1->result->geometry->location->lng;  
10:      echo "$lat1,$long1"; //spit out results or you can store them in a DB if you wish  
11:    }  
12:    if ($status1=="ZERO_RESULTS") {  
13:      //indicates that the geocode was successful but returned no results. This may occur if the geocode was passed a non-existent address or a latlng in a remote location.  
14:    }  
15:    if ($status1=="OVER_QUERY_LIMIT") {  
16:      //indicates that you are over your quota of geocode requests against the google api  
17:    }  
18:    if ($status1=="REQUEST_DENIED") {  
19:      //indicates that your request was denied, generally because of lack of a sensor parameter.  
20:    }  
21:    if ($status1=="INVALID_REQUEST") {  
22:      //generally indicates that the query (address or latlng) is missing.  
23:    }  
24:       function getaddress1($lat1,$long1)  
25:  {  
26:  $url1 = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat1).','.trim($long1).'&sensor=false';  
27:  $json1 = @file_get_contents($url1);  
28:  $data1=json_decode($json1);  
29:  $status1 = $data1->status;  
30:  if($status1=="OK")  
31:  return $data1->results[0]->formatted_address;  
32:  else  
33:  return false;  
34:  }  
35:  $address1= getaddress1($lat1,$long1);  
36:  if($address1)  
37:  {  
38:  echo $address1;  
39:  }  
40:  else  
41:  {  
42:  echo "Not found";  
43:  }  
44:  echo "<br/>";  
45:  $postcode = urlencode("ab13"); // post code to look up in this case status however can easily be retrieved from a database or a form post  
46:    $request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$postcode."&sensor=true"; // the request URL you'll send to google to get back your XML feed  
47:    $xml = simplexml_load_file($request_url) or die("url not loading");// XML request  
48:    $status = $xml->status;// GET the request status as google's api can return several responses  
49:    if ($status=="OK") {  
50:      //request returned completed time to get lat / lang for storage  
51:      $lat = $xml->result->geometry->location->lat;  
52:      $long = $xml->result->geometry->location->lng;  
53:      echo "$lat,$long"; //spit out results or you can store them in a DB if you wish  
54:    }  
55:    if ($status=="ZERO_RESULTS") {  
56:      //indicates that the geocode was successful but returned no results. This may occur if the geocode was passed a non-existent address or a latlng in a remote location.  
57:    }  
58:    if ($status=="OVER_QUERY_LIMIT") {  
59:      //indicates that you are over your quota of geocode requests against the google api  
60:    }  
61:    if ($status=="REQUEST_DENIED") {  
62:      //indicates that your request was denied, generally because of lack of a sensor parameter.  
63:    }  
64:    if ($status=="INVALID_REQUEST") {  
65:      //generally indicates that the query (address or latlng) is missing.  
66:    }  
67:       function getaddress($lat,$long)  
68:  {  
69:  $url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($long).'&sensor=false';  
70:  $json = @file_get_contents($url);  
71:  $data=json_decode($json);  
72:  $status = $data->status;  
73:  if($status=="OK")  
74:  return $data->results[0]->formatted_address;  
75:  else  
76:  return false;  
77:  }  
78:  $address= getaddress($lat,$long);  
79:  if($address)  
80:  {  
81:  echo $address;  
82:  }  
83:  else  
84:  {  
85:  echo "Not found";  
86:  }  
87:  /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/  
88:  /*::                                     :*/  
89:  /*:: This routine calculates the distance between two points (given the   :*/  
90:  /*:: latitude/longitude of those points). It is being used to calculate   :*/  
91:  /*:: the distance between two locations using GeoDataSource(TM) Products  :*/  
92:  /*::                                                                             :*/  
93:  /*:: Definitions:                              :*/  
94:  /*::  South latitudes are negative, east longitudes are positive      :*/  
95:  /*::                                     :*/  
96:  /*:: Passed to function:                          :*/  
97:  /*::  lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees) :*/  
98:  /*::  lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees) :*/  
99:  /*::  unit = the unit you desire for results              :*/  
100:  /*::      where: 'M' is statute miles                  :*/  
101:  /*::         'K' is kilometers (default)             :*/  
102:  /*::         'N' is nautical miles                 :*/  
103:  /*::                                              :*/  
104:  /*::                                            :*/  
105:  /*::                                          :*/  
106:  /*:: For enquiries, please comment below    :*/  
107:  /*::                                     :*/  
108:  /*::         Ahmed Developer             :*/  
109:  /*::                                     :*/  
110:  /*::                                     :*/  
111:  /*::                                     :*/  
112:  /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/  
113:  function distance($lat3, $lon3, $lat4, $lon4, $unit) {  
114:   $theta = $lon3 - $lon4;  
115:   $dist = sin(deg2rad($lat3)) * sin(deg2rad($lat4)) + cos(deg2rad($lat3)) * cos(deg2rad($lat4)) * cos(deg2rad($theta));  
116:   $dist = acos($dist);  
117:   $dist = rad2deg($dist);  
118:   $miles = $dist * 60 * 1.1515;  
119:   $unit = strtoupper($unit);  
120:   if ($unit == "K") {  
121:    return ($miles * 1.609344);  
122:   } else if ($unit == "N") {  
123:     return ($miles * 0.8684);  
124:    } else {  
125:      return $miles;  
126:     }  
127:  }  
128:  echo "<br/>";  
129:  $mm=distance("$lat1", "$long1", "$lat", "$long", "M");  
130:  echo number_format((float)$mm, 2, '.', ''). " Miles<br>";  
131:  //echo distance("$lat1", "$long1", "$lat", "$long", "K") . " Kilometers<br>";  
132:  //echo distance("$lat1", "$long1", "$lat", "$long", "N") . " Nautical Miles<br>";  
133:  ?>  

Wednesday, 31 July 2013


Any Video Converter (AVC) is the best tool to convert videos. Using this software, we can easily convert all the type of videos into different formats e.g. mobile video, Flash video, DVD. MPEG,  mkv. Mp3, Mp4 etc. The software takes very short time to convert a video. It is auto registered software and very simple to install and use.



How to install:-

There are five simple steps to install this software.

STEP 1:-Open the folder containing software of AVC. Click the icon.

STEP 2:-Following box will appear on screen and you have to adjust the language suitable to you.


STEP 3:-Then by following the easy instructions you will reach to the box.



STEP 4:-Press install and wait for few seconds till installation complete. Then press finish.



STEP 5:-When you press finish, the installation will complete and software will appear on screen for working




How to use:-


The working of this converter is quite simple. You may follow the following steps to use.

There are three simple steps to convert a video using any video converter.

STEP 1:-Click the button and add videos which you want to convert.



STEP 2:-Select the output format. And set the desired output folder like this.



STEP 3:-Then press convert button ant wait for few seconds to complete conversion.
When conversion will complete the following box will appear. you may open the output folder and use the converted file.



For feedback, e-mail to      (jaq101@yahoo.com)