Sunday, 26 March 2017

how to make a search form with multiple search options in php

Suppose These are fields:-

$user_name = $_POST[‘user_name’]$city = $_POST[‘city’]

Take a variable:-

$sql = ‘SELECT * FROM USER_TABLE WHERE 1=1’;

(i)   Now if user fills something in user_name:-

If(!empty($user_name))Then :-$sql = $sql . ‘AND user_name = ’.$user_name;

(ii) Now if user fills something in city:-

If(!empty($city))Then :-$sql = $sql . ‘AND city = ’.$city;And then run this query :- mysql_query($sql) 

Thursday, 9 March 2017

Equal height js

equalheight = function (container) {

var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(container).each(function () {

$el = $(this);
$($el).height('auto')
topPostion = $el.position().top;

if (currentRowStart != topPostion) {
for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
rowDivs.length = 0; // empty the array
currentRowStart = topPostion;
currentTallest = $el.height();
rowDivs.push($el);
} else {
rowDivs.push($el);
currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
}
for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
});
}

.... add your  class .... 

$(window).load(function () {
equalheight('.equal .pray');
});
$(window).resize(function () {
equalheight('.equal .pray');
});