Archive for May, 2014

mysql table for USA states

Posted: May 28, 2014 in Mysql

INSERT INTO  states(id, countryId, name, statecode) VALUES
(NULL, ‘239,’Alabama’,’AL’),
(NULL, ‘239,’Alaska’,’AK’),
(NULL, ‘239,’Arizona’,’AZ’),
(NULL, ‘239,’Arkansas’,’AR’),
(NULL, ‘239,’California’,’CA’),
(NULL, ‘239,’Colorado’,’CO’),
(NULL, ‘239,’Connecticut’,’CT’),
(NULL, ‘239,’Delaware’,’DE’),
(NULL, ‘239,’District of Columbia’,’DC’),
(NULL, ‘239,’Florida’,’FL’),
(NULL, ‘239,’Georgia’,’GA’),
(NULL, ‘239,’Hawaii’,’HI’),
(NULL, ‘239,’Idaho’,’ID’),
(NULL, ‘239,’Illinois’,’IL’),
(NULL, ‘239,’Indiana’,’IN’),
(NULL, ‘239,’Iowa’,’IA’),
(NULL, ‘239,’Kansas’,’KS’),
(NULL, ‘239,’Kentucky’,’KY’),
(NULL, ‘239,’Louisiana’,’LA’),
(NULL, ‘239,’Maine’,’ME’),
(NULL, ‘239,’Maryland’,’MD’),
(NULL, ‘239,’Massachusetts’,’MA’),
(NULL, ‘239,’Michigan’,’MI’),
(NULL, ‘239,’Minnesota’,’MN’),
(NULL, ‘239,’Mississippi’,’MS’),
(NULL, ‘239,’Missouri’,’MO’),
(NULL, ‘239,’Montana’,’MT’),
(NULL, ‘239,’Nebraska’,’NE’),
(NULL, ‘239,’Nevada’,’NV’),
(NULL, ‘239,’New Hampshire’,’NH’),
(NULL, ‘239,’New Jersey’,’NJ’),
(NULL, ‘239,’New Mexico’,’NM’),
(NULL, ‘239,’New York’,’NY’),
(NULL, ‘239,’North Carolina’,’NC’),
(NULL, ‘239,’North Dakota’,’ND’),
(NULL, ‘239,’Ohio’,’OH’),
(NULL, ‘239,’Oklahoma’,’OK’),
(NULL, ‘239,’Oregon’,’OR’),
(NULL, ‘239,’Pennsylvania’,’PA’),
(NULL, ‘239,’Rhode Island’,’RI’),
(NULL, ‘239,’South Carolina’,’SC’),
(NULL, ‘239,’South Dakota’,’SD’),
(NULL, ‘239,’Tennessee’,’TN’),
(NULL, ‘239,’Texas’,’TX’),
(NULL, ‘239,’Utah’,’UT’),
(NULL, ‘239,’Vermont’,’VT’),
(NULL, ‘239,’Virginia’,’VA’),
(NULL, ‘239,’Washington’,’WA’),
(NULL, ‘239,’West Virginia’,’WV’),
(NULL, ‘239,’Wisconsin’,’WI’),
(NULL, ‘239,’Wyoming’,’WY’, ”);


strstr() and stristr both are used to find the first occurence of the string but stristr( ) is case insensitive.

strstr() – Find first occurrence of a string

strstr ($string, string)

$email = ‘’;
$substring = strstr($email, ‘A’);
echo $substring;

// Output: Asekhar

stristr() – It is also works same but it is Case-insensitive

stristr ($string, string)

$email = ‘chandrAsekhar’;
$substring = stristr($email, ‘A’);
echo $substring;

// Output:

use the following code the check the date in given format or not

$format = ‘Y-m-d’;
$date = ‘2014-10-10’;

$input = trim($date);
$time = strtotime($date);

if(date($date_format, $time) == $input){

echo “true”;


echo “false”;

Unset used to destroy a variable. for example

remove array values:  // unset($a[5]); removing the 5th key value

remove the session varipable // unset($_SESSION[‘a’]);

destroy a variable // unset($i);

Whereas unlink is used to delete a file

ex:$file: $_SERVER[‘DOCUMENT_ROOT’].”/images/”.test.jpeg



== checks if the values of the two operands are equal or not.
=== checks the values as well as the type of the two operands.

echo “comparison true”;
echo “comparison false”;

// Output  = true

echo “true”;else
echo “false”;

// Output = false

jQuery Tips and Tricks

This is my first post on jQuery Tricks. I had written some posts on jQuery Tips earlier but none on this category. So, I thought it’s right the time to write one now. 😉

View original post 324 more words

Get Mouse coordinates

Posted: May 11, 2014 in Jquery
    //display the x and y axis values inside the P element
    $('.getMouseCoordinates').html("x coordinate : " + e.pageX + " <br> Y coordinate " + e.pageY);
<div class="getMouseCoordinates"></div>