Posts

Showing posts with the label export

How to get database backup in your mailbox daily automatically

ew web host do not offer a daily backup of MySQL database while few offer extra charge for automatic backup.This PHP script will help you to get database backup in your mailbox daily automatically. This script  performs three tasks.First it creates backup of MySQL database and save it server in .sql format.In second step it compress the .sql file and convert it in .zip format.At last ,it sends an email to provided email id with attached backup.To use this script you just need to assign the values for the variables $db_host , $db_user , $db_pass , $db_name , $tables and $email. <?php //File name:backup.php //Date:20 November 2012 //By: Amit Singh< admin@megarush.net > //Title:How to get database backup in your mailbox daily automatically //settings for MySQL database //change these variables before using $db_host=" localhost ";   //mysql host $db_user=" rashed ";  //databse user name $db_pass=" dbpassword ";  //database password $d...

Simple Microsoft Excel file generation via PHP and Mysql

config.php :- <?php $host_name="localhost"; $username="root"; $password=""; $db_name="test"; //Database Connection $conn=mysql_connect($host_name,$username,$password); //Database Select mysql_select_db($db_name,$conn); ?> BuyerAssistReport.php :- <?php error_reporting (E_ALL ^ E_NOTICE); include("config.php"); $query  = "SELECT * FROM fruit "; $result = mysql_query($query) or die(mysql_error().'Error, query failed'); $tsv=""; $html=""; $xml = ""; while($row = mysql_fetch_array($result)) {         $xml .="<tr><td>".$row['id']."</td><td>".$row['name']."</td><td>".$row['price']."</td></tr>"; } $html .= "<table border=1 style='border-color:#CCCCCC'><tr><td><b>Fruit id</b></td><td><b>Fruit name</b></td>...