Category Archives: PHP Programming

How to get table name by Model in Laravel 5?

Some times we requires get what’s the table name for particular Model. There is a function defined in Laravel itself name 1 getTable()getTable() Please look below example: 1 2 3 $transaction = new Transaction; $table = $transaction->getTable(); print_r($table); $transaction = new Transaction; $table = $transaction->getTable(); print_r($table);

How to display image from database in PHP?

Step1 : Fetch/Retrieve the image from datbase using database functions. Step2 : Now use the image tag below. <?php $convertedImage =’CONVERTED_IMAGE_FROM_DB’; ?> <img src="data:image/jpg|gif|png;charset=utf8;base64,$convertedImage" /> jpg/gif/png depends on the type of image.<?php $convertedImage =’CONVERTED_IMAGE_FROM_DB’; ?> <img src="data:image/jpg|gif|png;charset=utf8;base64,$convertedImage" /> jpg/gif/png depends on the type of image.

How to save image in Database using PHP ?

Step 1: First of all Convert image to binary.   <?php $imageURL =’YOUR_IMAGE_URL’; //or you can upload $convertedImage = base64_encode(file_get_contents($imageURL)); /** Now store $convertedImage in Database using database functions.**/   ?> <?php $imageURL =’YOUR_IMAGE_URL’; //or you can upload $convertedImage = base64_encode(file_get_contents($imageURL)); /** Now store $convertedImage in Database using database functions.**/ ?>

How to Translate Text to desired language ?

Just follow these steps and copy & paste the code you can translate text easily. Step 1 : Make a div with id (id is compulsory) Like <div id="content">Loading…</div><div id="content">Loading…</div> Step 2 : Paste the following code to head section under script tag of your webpage.   <script type="text/javascript"> google.load("language", "1");   function initialize() {… Read More »

How to Remove Characters Except Numbers from a String ?

Following Code will remove all character,special characters including space.   $givenNumber = "1245fdfd8454D FDFDF434 3$#$#%";   $testingNumber = preg_replace('[D]’, ”, $givenNumber);   echo $testingNumber;   Output is : 124584544343 $givenNumber = "1245fdfd8454D FDFDF434 3$#$#%"; $testingNumber = preg_replace(‘[D]’, ”, $givenNumber); echo $testingNumber; Output is : 124584544343

How to share your page or website ?

<!– AddToAny BEGIN –> <div> <a href="http://www.addtoany.com/share_save?linkurl=url_here&linkname=xyz">Share</a> <span class="a2a_divider"></span> <a class="a2a_button_twitter"></a> <a class="a2a_button_f<acebook"></a> </div> <script type="text/javascript"> var a2a_config = a2a_config || {}; a2a_config.linkurl = "your url here"; </script> <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script> <!– AddToAny END –><!– AddToAny BEGIN –> <div> <a href="http://www.addtoany.com/share_save?linkurl=url_here&linkname=xyz">Share</a> <span class="a2a_divider"></span> <a class="a2a_button_twitter"></a> <a class="a2a_button_f<acebook"></a> </div> <script type="text/javascript"> var a2a_config = a2a_config ||… Read More »