Author: darshakkumar
-
How to convert timestamp to date in MYSQL with where clause?
SELECT * , DATE( FROM_UNIXTIME( `time_stamp` ) ) AS sBdat FROM phpfox_feed WHERE DATE( FROM_UNIXTIME( `time_stamp` ) ) = ‘2012-09-05’
-
how to check element visibility in jquery?
example of element exists and it’s not visible <div id=”test”> <div id=”test_1″ style=”display:none”> Hello World! </div> </div> jQuery code: if ($(‘#test_1:visible’).length > 0) { alert(‘the element is visible’); } else { alert(‘the element is not visible’); }
-
how to replace & or special characters in javascript?
//if value of catnm=’art & jewllery‘; //then i want need to replace “&“. //because when i will try to post data using jquery then jquery know this is query string…..so i want to need to replace “&” using “URL ENCODED CHARACTERS” //so,see below example var catnm=document.getElementById(‘catnm’).value; var cat_re=catnm.replace(‘&’,’%26′); OUTPUT In Javascript alert box : art…
-
how to validate multiple select box with jquery?
$(“#form”).validate({ rules:{ “select_esp[]”: “required” }, messages:{ “select_esp[]”: “Select this” } });
-
How to enable/disable element in Javascript
If u want to enable or disable any HTML element using javascript in asp.net/php u can use the following code, document.getElementById(‘nm’).disabled=’disabled’ ; and the below code will enable the element, document.getElementById(‘nm’).disabled=”;
-
how to make captcha in php?
Captcha Code: <?php session_start(); $num=”; $string = “abcdefghijklmnopqrstuvwxyz0123456789”; for($i=0;$i<7;$i++){ $num1=rand(0,35); $num .= $string{$num1}; } $_SESSION[“num1”]=$num; $img=imagecreatefrompng(‘captcha.png’); $color=imagecolorallocate($img,255,255,255); $color1=imagecolorallocate($img,0,0,0); imagestring($img,9,10,3,$num,30); $fontsize=20; $fontcolor = imagecolorallocate($img, 0, 0, 0); $x = 0; $y = $fontsize; header(‘Content-type : image/png’); imagepng($img); imagedestroy($img); ?> How to use in php? <img id=”cap” style=”margin-left: 15px;” src=”comman/captcha.php” alt=”” /> How to refresh captcha? Call…
-
how to check path of ffmpeg or mencoder in linux in php?
<?php $output = shell_exec(‘whereis ffmpeg’); echo “<pre>”.$output.”</pre>”; echo “”; $output = shell_exec(‘whereis mencoder’); echo “<pre>”.$output.”</pre>”; echo “”; ?> Output in browser :
-
How to launch jQuery Fancybox on page load?
//first include fancybox javascript file and jquery javascript file. <script type=”text/javascript”> jQuery(document).ready(function() { $(“a#various2”).trigger(‘click’); }); </script>
