Author: darshakkumar
-
how to check browser window visibility using jquery
Whenever you switch the browser or tab then execute some events. Below is html & jquery code to check your browser window visibility Using this code : Check the title bar when you are switch the browser or tab. If title bar display “Active” it means you are on current tab or browser If title…
-
how to connect mysql from command prompt
First open command prompt : write command : mysql -u username -p database_name and press enter key and enter password of mysql Or write a command : mysql –user=username –password=password
-
Multi Dimensional array search in php
<?php function md_search($arr, $searched) { if (empty($searched) || empty($arr)) { return false; } foreach ($arr as $key => $value) { $exists = true; foreach ($searched as $skey => $svalue) { $exists = ($exists && IsSet($arr[$key][$skey]) && $arr[$key][$skey] == $svalue); } if($exists){ return $key; } } return false; } $arr = array(); $arr[] = array(‘color’=>’red’, ‘qty’=>3);…
-
how to use json in php?
//test.php <script type=”text/javascript” src=”http://code.jquery.com/jquery-2.1.0.min.js”></script> <input type=”button” name=”show” id=”show” value=”Click TO Show Data ” /> <br> Json Encode Data : <div id=”json_output” style=”border:#000 1px solid;width:337px;height:337px;overflow:auto”> </div> Json Output Data of output variable : <div id=”json_output_variable” style=”border:#000 1px solid;width:337px;height:337px;overflow:auto”> </div> <script type=”text/javascript”> $(“#show”).click(function (){ var datastr=’format=json&id=37′; $.ajax({ type:’POST’, data:datastr, url:’json.php’, success:function(html) { $(“#json_output”).html(html); var obj=JSON.parse(html);//decode the json…
-
what is the diffrence between echo ‘$a’, echo “$a” and echo $a?
$a=”Hello”; echo $a; // hello echo ‘$a’; // $a echo “$a”; // hello
-
what is the difference between $a and $aa?
$a=’hello’; $$a = ‘php’; $$$a=’world’; echo “$a ${$a} ${${$a}}”; Output : ==>hello php world More Information : http://www.php.net/manual/en/language.variables.variable.php
-
How to read html table tag in php?
<?php // new dom object $dom = new DOMDocument(); //load the html $html = $dom->loadHTMLFile(“test.html”); //discard white space $dom->preserveWhiteSpace = false; //the table by its tag name $tables = $dom->getElementsByTagName(‘table’); //get all rows from the table $rows = $tables->item(0)->getElementsByTagName(‘tr’); // loop over the table rows foreach ($rows as $row) { // get each column by…
-
how to get multiple select values in javascript
//Here client is id of multiple dropdown…. <select multiple=”multiple” id=”client” > <option value=’1′>1</option> <option value=’2′>2</option> <option value=’3′>3</option> </select> <input type=’button’ value=’Test’ onclick=’tes()’> <script type=’text/javascript’> function tes() { var cnt=document.getElementById(‘client’).length; var arr=new Array(); var j=0; for(var i=0;i<cnt;i++) { if(document.getElementById(“client”).options[i].selected == true) { …
-
How to convert mysql date format to own date format in MYSQL?
SELECT sum(rate),DATE_FORMAT(date_time, ‘%Y-%c-%d’) as dt FROM `trans_tble` group by `dt` Reff link : http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format
