Ajit N

CONCAT_WS() function

MySQL CONCAT_WS() function is used to join two or more strings with a separator. The separator specified in the first argument is added between two strings. The separator itself can be a string. If the separator is NULL the result is NULL. Syntax : [crayon-58d314c8b2b02798491349-i/] [crayon-58d314c8b2b0a527167365/]    Read more …

Parse json data error in javascript

Whenever parse the encoded json data through jquery function $.parseJSON(data) ,It checks for json object format so parse json data error occur for the json array formated data pass in the function. To solve this issue data encode with the json_encode($data,JSON_FORCE_OBJECT).Read more …

How to replace the src attribute of the img tag from given html in php.

Here is the code for replace the ‘src’ attribute of the img tag from given html and return well formed html with new src content. $doc = new DOMDocument(); @$doc->loadHTML($html); $tags = $doc->getElementsByTagName(‘img’); foreach ($tags as $tag) { $old_src = $tag->getAttribute(‘src’); $new_src_url = WEBURL.$old_src; $tag->setAttribute(‘src’, $new_src_url); } $new_content = $doc->saveHTML();Read more …