473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

creating SQL string 'on-the-fly' for backups purposes

hi,

i have recently used a system (oscommerce store) where you can backup
your database. what happens is that when you click 'backup database',
it creates an SQL string, stores it in a text file and lets you
download it to your hard drive.

is there a simple means of creating this SQL file? if not, are there
any free scripts available that can be used on any database/table and
create a SQL string to be stored in a text file?

also, how do you (once the SQL file has been created) then prompt the
user to save the file onto their computer? cheers

burnsy
Jul 17 '05 #1
12 1952
On 20 Jul 2004 06:45:20 -0700
bi******@yahoo.co.uk (mr_burns) wrote:
hi,

i have recently used a system (oscommerce store) where you can backup
your database. what happens is that when you click 'backup database',
it creates an SQL string, stores it in a text file and lets you
download it to your hard drive.

is there a simple means of creating this SQL file? if not, are there
any free scripts available that can be used on any database/table and
create a SQL string to be stored in a text file?

also, how do you (once the SQL file has been created) then prompt the
user to save the file onto their computer? cheers


Simple.
If you're on a *nix system, you can use the shell-command "mysqldump"
for dumping the content and forcing a download of the file is just a
simple http-header.

Example: Dump database "test" and offer download.
<?php
// username and password for the database
$db_user = "someuser";
$db_pass = "somepass";
$db = "test";

// Filename to suggest to the user.
$filename = "db_backup.sql";

// shell command
$cmd = "mysqldump -u $db_user -p $db_pass $db";

// send headers, forcing download:
header("Content-type: text/html");
header("Content-Disposition: attachment; filename=\"$filename\"");

// Run $cmd and pass the output directly to the browser.
passthru($cmd);
?>

Now you can just modify this to suit your needs (set the vars
dynamically perhaps) and point users to that for backing up their db.
If you're not on a *nix box I'm not sure how it's done, sorry. :(

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/SfdlNHJe/JASHcRAnIKAJ93bEAUl1INTgl+QQsmz5OSKUfw3QCaA0ty
qyxf+1yhgSLX1iMFNkuCcfI=
=2x3b
-----END PGP SIGNATURE-----

Jul 17 '05 #2
.oO(Anders K. Madsen)
If you're on a *nix system, you can use the shell-command "mysqldump"
for dumping the content and forcing a download of the file is just a
simple http-header.


mysqldump is part of the MySQL distribution, it should also be available
on Windows systems.

Micha
Jul 17 '05 #3
On Tue, 20 Jul 2004 16:25:41 +0200
Michael Fesser <ne*****@gmx.net> wrote:
.oO(Anders K. Madsen)
If you're on a *nix system, you can use the shell-command "mysqldump"
for dumping the content and forcing a download of the file is just a
simple http-header.


mysqldump is part of the MySQL distribution, it should also be
available on Windows systems.


Great! :)
Nice to know. Thanks!

Madsen
--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/UbclNHJe/JASHcRAnkBAJ4t95hYu9dOAXKEgpUtMZVaMQp1jwCff0GD
O1G2+Kq4h4B9vwPGWyPfRW4=
=zCIy
-----END PGP SIGNATURE-----

Jul 17 '05 #4
"Anders K. Madsen" wrote:
------------------------------------------------------------------------
Part 1.2Type: application/pgp-signature

What's with the attachments?

Brian Rodenborn
Jul 17 '05 #5
On Tue, 20 Jul 2004 17:48:46 GMT
Default User <fi********@boeing.com.invalid> wrote:
"Anders K. Madsen" wrote:
-----------------------------------------------------------------
-------
Part 1.2Type: application/pgp-signature


It's simply a PGP signature identifying me as ... well... me...
http://gnupg.org or http://fuckinggoogleit.com :-p

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/XCwlNHJe/JASHcRArI6AJ9oORd4aYIY7gcBl3O5d7Ka8P/SqgCfZL4w
ZeUXuRehHHV/VX+zG5dk0+c=
=6E6D
-----END PGP SIGNATURE-----

Jul 17 '05 #6
In article <20040720212118.5d381c31@lapsvin>, Anders K. Madsen wrote:
"Anders K. Madsen" wrote:
> -----------------------------------------------------------------
> -------
> Part 1.2Type: application/pgp-signature


It's simply a PGP signature identifying me as ... well... me...
http://gnupg.org or http://fuckinggoogleit.com :-p


And what exactly is the added value of knowing that a posting is yours
in this group? And how can we validate that the public key really
belongs to the person you pretend to be?

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
Jul 17 '05 #7
On 20 Jul 2004 19:30:49 GMT
Tim Van Wassenhove <eu**@pi.be> wrote:
In article <20040720212118.5d381c31@lapsvin>, Anders K. Madsen wrote:
"Anders K. Madsen" wrote:

>

-----------------------------------------------------------------> >
-------
> Part 1.2Type: application/pgp-signature


It's simply a PGP signature identifying me as ... well... me...
http://gnupg.org or http://fuckinggoogleit.com :-p


And what exactly is the added value of knowing that a posting is yours
in this group? And how can we validate that the public key really
belongs to the person you pretend to be?


Well, the added value is protection from posts being modified on it's
way (by malicious crax0rs or by malfunctioning software).

Read: http://fortytwo.ch/gpg/intro and
http://www.rubin.ch/pgp/weboftrust
Or once again... http://fuckinggoogleit.com

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/Zw0lNHJe/JASHcRAgUmAJ9VhHoPhRDcTqgHF/524xAiyv0XPQCeNTm1
kUyHUUTEIqWuwXXD3hUcmiU=
=b4OC
-----END PGP SIGNATURE-----

Jul 17 '05 #8
In article <20040721002656.0e5bb987@lapsvin>, Anders K. Madsen wrote:
Tim Van Wassenhove <eu**@pi.be> wrote:

And what exactly is the added value of knowing that a posting is yours
in this group? And how can we validate that the public key really
belongs to the person you pretend to be?
Well, the added value is protection from posts being modified on it's
way (by malicious crax0rs or by malfunctioning software).

Read: http://fortytwo.ch/gpg/intro and
http://www.rubin.ch/pgp/weboftrust


My question remains: How can we be sure the public key really belongs to
you? Even if this newsgroup would have a keysigning party, how would
newcomers be able to verify it? And no, hear-say solutions (public key
servers) are not a solution.

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
Jul 17 '05 #9
On 21 Jul 2004 07:26:00 GMT
Tim Van Wassenhove <eu**@pi.be> wrote:
In article <20040721002656.0e5bb987@lapsvin>, Anders K. Madsen wrote:
Tim Van Wassenhove <eu**@pi.be> wrote:

And what exactly is the added value of knowing that a posting is

yours> in this group? And how can we validate that the public key
really> belongs to the person you pretend to be?

Well, the added value is protection from posts being modified on
it's way (by malicious crax0rs or by malfunctioning software).

Read: http://fortytwo.ch/gpg/intro and
http://www.rubin.ch/pgp/weboftrust


My question remains: How can we be sure the public key really belongs
to you? Even if this newsgroup would have a keysigning party, how
would newcomers be able to verify it? And no, hear-say solutions
(public key servers) are not a solution.


My answer remains: http://www.rubin.ch/pgp/weboftrust
How can I be sure you are who you claim to be?
Right, I can't... 'cause anybody can put whatever name they desire in
the From header.
At least signing ones mail allows for some trust.

If you don't believe I am who I am, then fine... Don't sign my key...
Wait till more people have signed it and see if you'll believe it
then... That IS the way it works, no matter what you want it to be.

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/u1JlNHJe/JASHcRAkoMAJ4mFANyKA/C1/7x55WRkSEcJQ/4twCdGi5l
2zu+8mK6CvDh5Cn3xS1RPBY=
=Lwmj
-----END PGP SIGNATURE-----

Jul 17 '05 #10
>> My question remains: How can we be sure the public key really belongs
to you?


In this situation, an identity *IS* a key.

Assuming that the key is not compromised (or shared), all the posts
signed by the same key are from the same person, with high probability.
Posts signed by a different key MIGHT be from different people, or
possibly the same person. (A person can have more than one key,
especially if he soils his reputation badly using that key, or likes
to use sock puppets).

Human names on USENET posts are essentially useless if you've
got something better. And there's not much point in bothering
to worry about someone's human name unless you need to tie
it to a credit rating or bank account.

Gordon L. Burditt
Jul 17 '05 #11
In article <cd********@library1.airnews.net>, Gordon Burditt wrote:
In this situation, an identity *IS* a key. Human names on USENET posts are essentially useless if you've
got something better. And there's not much point in bothering
to worry about someone's human name unless you need to tie
it to a credit rating or bank account.


I agree that for this newsgroup (which is not about credit rating/bank
accounts) one should not bother much about identity/name. And that is
exactly why i don't see the use of signing usenet posts.
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
Jul 17 '05 #12
On 22 Jul 2004 08:51:13 GMT
Tim Van Wassenhove <eu**@pi.be> wrote:
In article <cd********@library1.airnews.net>, Gordon Burditt wrote:
In this situation, an identity *IS* a key.

Human names on USENET posts are essentially useless if you've
got something better. And there's not much point in bothering
to worry about someone's human name unless you need to tie
it to a credit rating or bank account.


I agree that for this newsgroup (which is not about credit rating/bank
accounts) one should not bother much about identity/name. And that is
exactly why i don't see the use of signing usenet posts.


Well, ok...
I'll keep signing them though, since I like people to know that I am in
fact me. If you don't believe it or find it useless, ok - your
problem. It's not like you're forced to sign my signature. And
besides... My mailer is configured to sign by default, which I kinda
happen to like...

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/4OAlNHJe/JASHcRAmTOAJ9lsasILBVqIsxWMapNPlQJjj/6DwCfdrsL
R75ebxHaHSD1JomsBnveRPQ=
=5qUY
-----END PGP SIGNATURE-----

Jul 17 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: morphex | last post by:
Hi all, I'm trying to create a script that will superimpose text on an image. I didn't find any great examples out there on how this can be done (I presume using PIL is necessary), do you know...
1
by: Paul | last post by:
HI I have a asp page which dynamically creates a table with 28 rows, 3 columns. Column 1 contains a label, column 2 contains a graphic, column 3 needs to contain a checkbox. I have no problems...
2
by: dangonzale | last post by:
I cannot use anchors on this page so I was wondering first of all if its possible and second if there are scripts out there that do this. I'd like javascript to find a text string on another page...
4
by: guilherme.torelli | last post by:
Hi. How can I create reports on Crystal Reports? I have a database already created on ms access 2003. Then, I want to create its report on Crystal Reports. Is it possible to do?
11
by: Horacius ReX | last post by:
Hi, I have to search for a string on a big file. Once this string is found, I would need to get the number of the line in which the string is located on the file. Do you know how if this is...
9
by: shailaja.sheel | last post by:
Hi , This is my first attempt to do some html/javascript programming and I am totally lost. I have a questionaire form and when user clicks Submit, I want to save the data in XML file on client...
1
by: rahat09 | last post by:
I am trying to load xml file as well as xml as string input, and have written following code. This is working in IE but not in FireFox, can anyone help? ...
4
by: Siyodia | last post by:
How to deploy an asp.net website in IIS6.0 Creating Websites not virtual directories
3
by: omar999 | last post by:
im trying to replace NULL with N/A but I think I have a syntax error .. how do you replace string on recordset via classic asp so on objRS17and18("Price_Band_1") should it be something like ...
6
by: Shaikh Rais | last post by:
In Asp.net Page <script type="text/javascript"><!-- function Showlogin(){popup.Show();} function Showloginx() { ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.