I would like to know the code about backup MySQL db to an email like if I click the button "send to my email" it will pop-up a modal (sb-admin bootstrap) saying, input your email. then it will go directly to that email.
In order to do this first of all you will have to dump the database.
You can use the exec() function to execute an external command.
exec('mysqldump --user=... --password=... --host=... DB_NAME > /path/to/output/file.sql');
This will dump the Db. then you will have to attach this file to send mail.
you can use phpmailer
to do this
To use PHPMailer:
Extract the archive and copy the script's folder to a convenient place in your project.
Include the main script file -- require_once('path/to/file/class.phpmailer.php');
Now, sending emails with attachments goes from being insanely difficult to incredibly easy:
$email = new PHPMailer();
$email->From = 'you@example.com';
$email->FromName = 'Your Name';
$email->Subject = 'Message Subject';
$email->Body = $bodytext;
$email->AddAddress( 'destinationaddress@example.com' );
$file_to_attach = 'PATH_OF_YOUR_FILE_HERE';
$email->AddAttachment( $file_to_attach , 'file.sql' );
return $email->Send();