Saturday, 5 October 2013

highlight word in php

highlight word in php


PHP coding tips for Performance Improvement devloper must see

PHP coding tips for Performance Improvement devloper must see


Mssql pagination query

Mssql pagination query

$sql="SELECT * FROM(
SELECT row_number() OVER (ORDER BY TransactionID) AS No, p.*
FROM payflow_reporting p
$where_filter
) AS A
WHERE A.No BETWEEN (?) AND (?)";

$query=$this->db->query($sql, array( $offset, $limit));
return $query->result();

Make ajax call using core javascript

Make ajax call using core javascript

ref url http://stackoverflow.com/questions/3946446/why-is-my-code-failing-to-pass-parameters-from-javascript-to-jsp-using-xmlhttpre

For passind data using post use following code
var myVar1 = encodeURIComponent("c6c684d9cc99476a7e7e853d77540ceb");
xhr.open("POST", "http://csce:8080/test/index.jsp", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("id=" + myVar1);

find distance from latitude and longitude with mysql

find distance from latitude and longitude with mysql

$radius = 1;
$my_lat = 21.21586;
$my_long = 72.86315;

//3959 for miles and 6371 for km
$res = mysql_query("SELECT *, ( 3959 * acos( cos( radians('$my_lat') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('$my_long') ) + sin( radians('$my_lat') ) * sin( radians( latitude ) ) ) ) AS distance FROM map_point HAVING distance < '$radius' ORDER BY distance");

returns data from 1 mile radius from given $my_lat and $my_long

Get tweets from twitter account with php

Get tweets from twitter account with php


Get Follower List of twitter

Get Follower List of twitter

file_get_contents("https://api.twitter.com/1/followers/ids.json?screen_name='SCREEN NAME'&cursor=-1");