Jun 6, 2010
MySQL Database restore
I have already listed the PHP script to generate backup of database in one of my earlier post.
I am listing here the PHP script to restore database from mysql database file.
<?php
/* Database Restore */
$username = "dbusername"; //database username
$password = 'dbpass'; //database password
$hostname = "localhost"; //host
$dbname = "dbname"; //database name to be...
read more
Mar 10, 2010
Insert and Retrieve file with MySQL
Some of you might be knowing that there is a functionality in MySQL database for storing files and retrieving the same.
This is mainly used when we need to reduce response time for retrieving and using files in our application.
I am listing here the method for inserting image file in and retrieving image file from MySQL database using PHP.
1) For inserting data into MySQL you need to convert the image...
read more
Feb 1, 2010
Database Backup
I am listing here the PHP script to generate backup of database.
<?php
/* Database Backup */
$username = "dbusername"; //database username
$password = 'dbpass'; //database password
$hostname = "localhost"; //host
$dbname = "dbname"; //databse name
$sConnString = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$name...
read more
Jan 21, 2010
Queries in Magento
I am describing here the method for executing custom MySQL queries in Magento.
<?php
//select query
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
//make connection
$qry = "select name FROM user_data WHERE id=1 LIMIT 1 "; //query
$res = $read->fetchRow($qry); //fetch row
$name = $res['name']; //outputs name
//other form
$qry =...
read more
Jan 13, 2010
Connect different database from Magento
Some of you might have worked on Magento.
I am listing here points for connecting another database from Magento.
1) Suppose your database for Magento Project is named ‘magento’.
2) There is one other database named ‘wp’.
3) For using this database inside Magento, you need to setup connection in ‘config.xml’ file which resides in ‘urmagentodirectory/app/etc’
4) In ‘config.xml’ there...
read more
