Quantcast
Channel: phpHelp.co » PHP
Browsing all 15 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

How to take backup dump of MySQL database with PHP script

Here is a simple script to take backup of MySQL database, using a PHP script. <?php backup_tables(‘localhost’,'username’,'password’,'dbname’); /* backup the db OR just a table */ function...

View Article



Can you recommend some post upload checks?

Delete unwanted files, like ‘test’, ‘copy of’, etc. Give write permission (777) to the required folders. If .htaccess file has been uploaded, make sure it runs according the the server settings....

View Article

How do I detect mobile browser in PHP?

// Create the function, so you can use it function isMobile() { return...

View Article

What are some good WordPress plugins

Business Directory Calendar Contact Form Custom Post Order My Post Order My Page Order Fancy Transition Header Slider Google Analytics Sharethis Simple Pagination Spider FAQs White Label CMS .html on...

View Article

Image may be NSFW.
Clik here to view.

How to download a file on server in PHP

<?php $file = ‘http://www.url.com/file.zip’; $newfile = ‘newfile.zip’; if (!copy($file, $newfile)) { echo “failed to copy $file…\n”; } ?>

View Article


How to recursively extract/unzip a folder in PHP

$zip = new ZipArchive; $zip->open(‘innovapain.zip’); $zip->extractTo(‘./’); $zip->close();

View Article

PATH_INFO not working on Godaddy how to enable PATH_INFO in Godaddy

Create a file named “php5.ini”, add the following text cgi.fix_pathinfo = On Upload this file to the root directory of your web site, wait for some minutes.

View Article

Image may be NSFW.
Clik here to view.

How to prevent ENTER keypress to submit a web form

Place the following code in head. <script type=”text/javascript”> function searchItem(e){ e = e? e : window.event; var k = e.keyCode? e.keyCode : e.which? e.which : null; if (k == 13){ if...

View Article


How to make .htaccess rewrite rules for URL with or without “www”

#Redirect www to non-www RewriteEngine on RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] #Redirect non-www to www RewriteEngine on...

View Article


How to switch on PHP magic quotes gpc and magic quotes runtime on Hostgator...

There are two steps involved in it. First, under public_html folder, in .htaccess file write the following code. <IfModule mod_suphp.c> suPHP_ConfigPath /home/username <Files php.ini> order...

View Article

How to download large files in PHP using cURL

<?php $url = 'http://www.example.com/a-large-file.zip'; $path = $_SERVER['DOCUMENT_ROOT'] . '/downloads/a-large-file.zip'; $fp = fopen($path, 'w'); $ch = curl_init($url); curl_setopt($ch,...

View Article

MAMP on Mavericks updated to Yosemite – Apache does not start

Rename the file “envvars” located in /Applications/MAMP/Library/bin into “_envvars” and it should work like charm.

View Article

How to generate a dropdown of PHP time zones

$timezones = array ( '(GMT-12:00) International Date Line West' => 'Pacific/Wake', '(GMT-11:00) Midway Island' => 'Pacific/Apia', '(GMT-11:00) Samoa' => 'Pacific/Apia', '(GMT-10:00) Hawaii'...

View Article


Image may be NSFW.
Clik here to view.

How to sort and print multidimensional array in PHP

<?php $result = array( array(‘name’ => ‘John’, ‘age’ => ’40′), array(‘name’ => ‘James’, ‘age’ => ’30′), array(‘name’ => ‘Ana’, ‘age’ => ’20′), array(‘name’ => ‘Tania’, ‘age’...

View Article

Image may be NSFW.
Clik here to view.

PHP MongoDB case insensitive sorting (Solved)

Although MondoDB does not offer it, but you can very easily do it in PHP or any other language. Here is how to do it in PHP. <?php $cn = new MongoClient($dbHost); $db = $cn->selectDB($dbName);...

View Article

Browsing all 15 articles
Browse latest View live




Latest Images