Facebook Page feed on website-PHP

Following is the code to display your facebook page feed on your website using PHP, cURL : It would display top 5 posts on your Facebook page as the limit which I gave here 5. All you would need is your PAGE-ID, APP-ID, APP-SECRET $page_name = yourpage_name; // Example: http://facebook.com/{PAGE_NAME} $page_id = yourpageid; // can get […]

Read More

MySQL calculate distance between two latitude/longitude coordinates

–Returns the distance in kilometers, assuming an earth radius of 6,371 km. SELECT D.idx,D.name,( 6371 * ACOS( COS( RADIANS(C.latitude) ) * COS( RADIANS( D.latitude ) ) * COS( RADIANS( D.longitude ) – RADIANS(C.longitude) ) + SIN( RADIANS(C.latitude) ) * SIN( RADIANS( D.latitude ) ) ) ) AS kms FROM dealers D,cities C GROUP BY D.idx […]

Read More

jquery-keep in mind

Never keep 2 ids with the same name on the same page. You can keep 2 classes with the same name but not 2 ids. I was working on a header-script where 2 files were included.Both mobile_header.php and desktop_header.php included a javascript file. As the same file was included twice it was causing problem in showing […]

Read More

Dropdown arrow change on click

Code for changing the dropdown arrow on click. You can change the arrow from + to – You can change the symbols you want.[up-down,plus-minus etc]. Javascript code: function changeText(idElement) { var element = document.getElementById(‘element’ + idElement); if (idElement === 1 || idElement === 2 ) { if (element.innerHTML === ‘+’) element.innerHTML = ‘ -‘; else […]

Read More

Include different PHP files depending on the screen size

Following is the way to include a different header on different screen sizes: I have used 2 different headers: mobile_header.php desktop_header.php   <style type=”text/css”> @media only screen and (min-width: 768px) { /* tablets and desktop */ div#mobile { display: none } } @media only screen and (max-width: 767px) { /* phones */ div#desktop { display: none […]

Read More

Facebook Page Feed

To get the Facebook feed on your website you need to follow the code which I have written below. load_face_posts(); function load_face_posts() { $page_name = krina; // Example: http://facebook.com/{PAGE_NAME} $page_id = 123; // can get form Facebook page settings $app_id = 123; // can get form Developer Facebook Page $app_secret = 123; // can get […]

Read More

PHP-File Handling

File Handling fopen() The fopen() function is used to open files in PHP. Using the correct mode parameter is very important at this point, as it identifies the type of file access that will be required. Below is a list of all possible mode parameters you can use with the fopen() function. If file open […]

Read More

PHP QUESTIONS AND ANSWERS

1. What do you mean by array? Explain with example various ways to define array in PHP? 2. Explain with example: foreach loop for arrays and while loop for arrays. 3. List and explain various array operators. 4. Explain with example: Multi dimensional array. A multidimensional array is an array containing one or more arrays. […]

Read More

Dynamic Charts Using PHP

Some people say that in PHP we cannot create charts. Others say that for creating chart we need to use plugins. But, I have found an easy solution of creating dynamic charts , without using any plugins in PHP. I have written this code to display the number of inquiries received by a college and […]

Read More