Skip to main content

Posts

Showing posts from June, 2016

Search Table Row by jquery

Search Table Row by jquery Search content from table using jQuery. Live searching method via jquery Create function to remove highlight content. If content not matched. function removeHighLighting (elm){         elm.each(function(){             var element = $(this);             element.replaceWith(element.html());         })     } Create function to highlight matched content. function addHighLighting (elm, data){         var text = elm.text();         var highlightedText = '<em>' + data+ '</em>';         var newText = text.replace(data, highlightedText);         elm.html(newText);     } Search text on keyup $("#search").on("keyup", function() {         var value = $(this).val();          removeHighLighting ($("table tr em"));         $("table tr").each(function(index) {             if (index !== 0) {                 $row = $(this);                         var $tdElement = $row.find("td:first")

Server Side Datatable handling using PHP and MySql

Server Side Datatable handling using PHP and MySql jQuery datatable server side processing. Using jQuery Ajax and MySql. Step 1: View Layout for display Student Record index.html  <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />         <title>Server Side Datatable handling</title>         <link rel="stylesheet" id="font-awesome-style-css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css" media="all">         <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css"/>                 <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js"></script>         <script type=

PHP Save Image in Base64 Encode Format

Save image in database in base64_encode format. 1. Create HTML Form <!DOCTYPE html> <html> <body> <form action="upload.php" method="post" enctype="multipart/form-data">     Select image to upload:     <input type="file" name="to_upload" id="fileToUpload">     <input type="submit" value="Upload Image" name="submit"> </form> </body> </html> 2. Now in upload.php if(!empty($_FILES)){     $extension = pathinfo($_FILES["to_upload"]["tmp_name"], PATHINFO_EXTENSION);     $image_content = file_get_contents($_FILES["to_upload"]["tmp_name"]);     $image_content = base64_encode($image_content);     $binaryData = 'data:image/' . $extension . ';base64,' . $image_content; } Store $binaryData value in database. 3. Html form your you need to display. <img src="<?php