Skip to main content

Posts

Showing posts from March, 2018

Remove all whitespaces from the entire column using MySQL Query

The below queries will remove all spaces, tabs characters, new line characters first and last space(s) from the table column. For replace all spaces :  UPDATE `table` SET `col_name` = REPLACE(`col_name`, ' ', '') For remove all tabs characters :  UPDATE `table` SET `col_name` = REPLACE(`col_name`, '\t', '' ) For remove all new line characters :  UPDATE `table` SET `col_name` = REPLACE(`col_name`, '\n', '') http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace For remove first and last space(s) of column :  UPDATE `table` SET `col_name` = TRIM(`col_name`) http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim

Get current filename with first parameter(Query String) from URL using PHP function

Today eabhyas come up with a Query String function. This function is useful to get the Query String from URL. This Function is used to get current filename with first parameter(Query String) from URL using PHP function . Function: function rns_QueryString_first($incomingURL){     preg_match('/[^&]+/', $incomingURL, $match);     return $outgoingURL = $match[0]; } Example: $path="property_add?id=3&aa=aa&b=123"; define('RNSFIFQ', rns_QueryString_first($path)); echo RNSFIFQ; Output: property_add?id=3

Remove Duplicate QueryStrings from URL using PHP

This simple PHP function is used to Remove Duplicate QueryStrings from URL. Function: function rnsQueryString_dupremov($qstring){     if(!empty($qstring)) {     $vars = explode('&', $qstring);     $final = array();     if(!empty($vars)) {         foreach($vars as $var) {             $parts = explode('=', $var);                 $key = $parts[0];             if(!empty($parts[1])) { $val = $parts[1]; } else {$val="";}                 if(!array_key_exists($key, $final) && !empty($val))                 $final[$key] = $val;         }     }     return http_build_query($final);     } else { return false; } } Example: $path="property_add.php?id=3&aa=aa&b=123&b=123&aa=aa"; define('RNSFIWQ', property_add.'?'.rnsQueryString_dupremov($_SERVER['QUERY_STRING']));  or define('RNSFIWQ', basename($_SERVER['SCRIPT_NAME'].'?'.rnsQueryString_dupremov($_SERVER['QUE

Country dropdown list - HTML select/dropdown snippet

Country dropdown list with country name as value: <!-- Country dropdown list by ahandy --!> <select>     <option value="Afghanistan">Afghanistan</option>     <option value="Albania">Albania</option>     <option value="Algeria">Algeria</option>     <option value="American Samoa">American Samoa</option>     <option value="Andorra">Andorra</option>     <option value="Angola">Angola</option>     <option value="Anguilla">Anguilla</option>     <option value="Antartica">Antarctica</option>     <option value="Antigua and Barbuda">Antigua and Barbuda</option>     <option value="Argentina">Argentina</option>     <option value="Armenia">Armenia</option>     <option value="Aruba">Aruba</option>     <option value="Aus

EBS Payment Gateway PHP integration kit - Version 3-PHP Integration kit

New EBS Version 3 Integration kit , based on PHP platform, can be downloaded from the following link: https://support.ebs.in/app/ind ex.php?/default_import/Knowled gebase/Article/View/620/29/ version-3-php-integration-kit Integration Guide can be downloaded through: https://support.ebs.in/app/ind ex.php?/Knowledgebase/Article/ View/651/29/ebs_integration_ guide_301 To fetch your secret key kindly login to your merchant console panel ( secure.ebs.in ) and navigate to Account >> Settings. (Login credentials will be automatically triggered to registered email id, once the account is made LIVE from our end) Kindly note that by default your EBS account is configured to use SHA512 as the hashing algorithm in the payment page template. Method to calculate the hash for request parameters: MD5/SHA1/SHA512: Hash should be calculated for all posting parameters along with your secret key. First, all the posting parameters should be sorted in ascending order and then with the secret ke

Highlight the navigation menu for the current page

JavaScript: <script src="JavaScript/jquery-1.10.2.js" type="text/javascript"></script> <script type="text/javascript">     $(function() {         // this will get the full URL at the address bar         var url = window.location.href;         // passes on every "a" tag         $(".topmenu a").each(function() {             // checks if its the same on the address bar             if (url == (this.href)) {                 $(this).closest("li").addClass("active");                 //for making parent of submenu active                $(this).closest("li").parent().parent().addClass("active");             }         });     });        </script> HTML Code: <div class="topmenu">   <ul class="nav">     <li><a href="index.html">Home</a></li>     <li><a href="about.html">About Us</a></li>