PDO query to fetch all tables

by in , 0

Execute the query with PDO::query():
SHOW TABLES;
If you fetch an associative array, the name of the column will be:
Tables_in_databasename
Note: this will list both tables and views. If you must get only tables, use this instead:
SELECT 
  TABLE_NAME
FROM information_schema.TABLES 
WHERE
  TABLE_TYPE='BASE TABLE'
  AND TABLE_SCHEMA='yourdatabasename';

PHP Fix errors if mbstring is not loaded

by in 0

My script work good on shared hosting until hosting disable mbstring

Now my script can't run.
Many functions MB_  mb_strrpos mb_get_info .... get undefined errors.

Read more »

How to download Free pdf from Scribd without paying

by 0

Download pdf from Scribd without paying : Are you searching for pdf or ebook??? Scribd.com is world largest digital library and has very large collection of documents which can you download either in PDFs format or doc.
As a student, I know the value of eBooks and no one wants to pay for the eBook. A few weeks ago I was searching for ebook and surprisingly I found that solely on Scribd so eagerly click on the download button, but after registering on this site it offers membership which requires a few dollars. But like me you can download any free document from Scribd by following simple steps.

Read more »

Htaccess show no_found picture if picture is not exist

by in , 0

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*$ /no_picture.png [L]
Let's break it down as to what each line means.
RewriteCond %{REQUEST_URI} \.(jpg|jpeg|gif|png)$ [NC]
Check to see if the requested file is of a file extension in the parentheses (). In this case, we're testing to see if the file name ends in either .jpg, .jpeg, .gif or .png
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Check that the file is not there and it's also not a directory.
RewriteRule .*$ /no_picture.png [L]
If a requested resource/file passes all those tests, then it's an image that does not exist. So serve back the image of no_picture.png to the browser. This will keep the filename. If you want to redirect to the no_picture.png filename, change [L] to [R]

auto refresh for every 5 mins in Javascript

by in 0

We can do this function with just html  or just javascript

Refresh document every 300 seconds using HTML Meta tag add this inside the head tag of the page
 <meta http-equiv="refresh" content="300">
Or using Java Script:
            setInterval(function() {
                  window.location.reload();
                }, 300000); 

jQuery javascript regex Replace br tag with \n

by in , , 0

var str = document.getElementById('mydiv').innerHTML;
document.getElementById('mytextarea').innerHTML = str.replace(/<br\s*[\/]?>/gi, "\n");
or using jQuery:
var str = $("#mydiv").html();
var regex = /<br\s*[\/]?>/gi;
$("#mydiv").html(str.replace(regex, "\n"));
edit: added i flag
edit2: you can use /<br[^>]*>/gi wich will match anything between the br and slash if you have for example <br />

Source:

jQuery javascript regex Replace <br> with \n

disable selected options by jQuery

by in , 0

This will disable/enable the options when you select/remove them, respectively.
$("#theSelect").change(function(){          
    var value = $(this).val();
    if (value === '') return;
    var theDiv = $(".is" + value);

    var option = $("option[value='" + value + "']", this);
    option.attr("disabled","disabled");

    theDiv.slideDown().removeClass("hidden");
    theDiv.find('a').data("option",option);
});


$("div a.remove").click(function () {     
    $(this).parent().slideUp(function() { $(this).addClass("hidden"); });
    $(this).data("option").removeAttr('disabled');
});
Source: 
jQuery - disable selected options