May 1, 2013 Vignesh Sathiyanantham 2Comment

Taking backup dump and importing the dump into database can be done very easily using php. In Last posts i explained how to take the backup of Mysql using php http://asvignesh.in/take-mysql-backup-using-php-passthru-function , http://asvignesh.in/take-mysql-backup-using-php Here is the function to import the sql dump into database function import_dump($folder_name = null , $file_name) { $folder_name = ‘dumps’; $path = ‘assets/backup_db/’; // Codeigniter application /assets $file_restore = $this->load->file($path . $folder_name . ‘/’ . $file_name, true); $file_array = explode(‘;’, $file_restore); foreach ($file_array as $query) { $this->db->query(“SET FOREIGN_KEY_CHECKS = 0”); $this->db->query($query); $this->db->query(“SET FOREIGN_KEY_CHECKS = 1”); } }

May 1, 2013 Vignesh Sathiyanantham 2Comment

In the last post i explained about taking the MySQL backup using php code , This post explains to take the backup of your MySQL database using the passthru function ( passthru documentation ) The passthru() function is similar to the exec() function in that it executes a command. This function should be used in place of exec() or system() when the output from the Unix command is binary data which needs to be passed directly back to the browser <?php $datestamp = date(“Y-m-d”); // Present date to append in the filename for the identification /* CONFIGURE THE FOLLOWING SEVEN…

May 1, 2013 Vignesh Sathiyanantham

One of the most important task of developer or administrators is to take backup periodically, Most of the hosting provider and cloud providers charge more for taking backup periodically , SaaS application developers or CMS developers can let the user to take the backup of the data using the interface. Here is the easy way to take the backup dump of the MySQL take_dump(‘DB_HOST’,’UNAME’,’PASS’,’DB’); /* backup the db OR just a table */ function take_dump($host,$user,$pass,$name,$tables = ‘*’) { $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); //get all of the tables if($tables == ‘*’) { $tables = array(); $result = mysql_query(‘SHOW TABLES’); while($row = mysql_fetch_row($result))…

April 28, 2013 Vignesh Sathiyanantham 1Comment

Here is the simple way to host your media files ( images , videos , audios) in Amazon S3 ( Simple Storage Service Amazon’s Simple Storage Service provides a simple web server to access any file that is stored in their storage cloud. This means, you can access files stored at S3, directly via a web browser, if you have set the permissions as “read” for all users. You can teach your clients to use S3 to host media files, which do not need scripting on the web server side and not require a lot of bandwidth to serve, e.g….

April 28, 2013 Vignesh Sathiyanantham

Some time back there was only one way to run MySQL on the cloud. Setup cloud , install MySQL and maintain it yourself the hard thing is managing backups, handling replication failures, maintaining server. Then AWS RDS came along and can be thought of as a PaaS for MySQL – it hides all the complexities behind the scenes and you only concern yourself with the database and not the database software.  WHY RDS: Simple UI to automate backup , setting backup time and retention copies Easy to restore backup snapshots AWS will apply patches that are security and durability related….

April 28, 2013 Vignesh Sathiyanantham

Here is the some tips for the web admins and the web developers to speed up the image heavy website The Major drawback in the Image heavy websites is it takes more time to load , user lose their patience and just navigate away from your website Don’t use Flash Animation is unnecessary, but if you feel you need it, try: Spritely, a free jQuery plugin that lets you create animation with HTML and JavaScript or create your own animated GIFs using Photoshop or GIMP ( Image editor ) Use storage service for images Most browsers will only load two or…

April 28, 2013 Vignesh Sathiyanantham 2Comment

Removing index.php in Codeigniter application url in godaddy shared hosting server Create the .htaccess file under root of application directory RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.php|robots.txt) RewriteRule ^(.*)$ index.php?/$1 [L] If you are getting “no input file specified” ( codeigniter / wordpress ) Login to godaddy account Goto hosting Under settings frame select file extension management Here you will find this “.php PHP 5.2.x FastCGI” click on edit button change it to “.php PHP 5.2.x” no need to change for .php5, .php4 Thats it  

April 21, 2013 Vignesh Sathiyanantham 1Comment

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks You can create a dynamic sub-domains store_name.asvignesh.in username.asvignesh.in Step 1: DNS Configuration First, we need to configure our DNS settings to make all subdomains resolve to a single address. If you are working on a live server, then you will have to change your…

April 14, 2013 Vignesh Sathiyanantham

We can submit the html form page by pressing submit button and the shortcut way is pressing enter ( return ) button on keyboard after filling up the form Here is the post to explain how to submit a form by pressing enter button using jQuery Generally, a form is submitted when the user presses a submit button. However, sometimes, you may need to submit the form when the user press return key ( enter key) Here is the code to submit the form by pressing the enter key <html> <head> https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js <script> function formSubmit() { document.getElementById(“frm1”).submit(); } $(‘#submit_form’).keypress(function…

April 14, 2013 Vignesh Sathiyanantham

Here is the solution to fetch the data from another Database instance in word press How To Use WPDB Class to connect and fetch data from another database host Let’s say you’ve installed wordpress into the database wp_wordpress and you want to fetch some data from another independent database which has nothing to do with wordpress (ex. mydb). Here’s how you can do it. Querying for Data Using WPDB Now, here’s the trick. You have to instantiate a new WPDB instance $mydb= new wpdb(‘username’,’password’,’db_name’,’db_host’); $rows = $mydb->get_results(“select columnName from tableName”); foreach ($rows as $obj) { echo $obj->columnName; } That saves…