Jump to content

Mysql BackUp


onlyican

Recommended Posts

Hey guys

I am looking at creating an option to back up the databases, creating a wicked .sql file

Currently I would back up using Mysql-front
Which will give me a result such as

CREATE TABLE IF NOT EXISTS mytable (
id_num INT(12) auto_increment,
name VARCHAR(150) DEFAULT NULL,
PRIMARY KEY (id_num),
) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=latin1

Which I can do using the Mysql Function SHOW CREATE TABLE mytable

BUT

How would I get the data

Would I do something like
[code]
<?php
$query = "SELECT * FROM mytable";

$result = mysql_query($query);

while($row = mysql_fetch_assoc($result)){
$update[] = "INSERT INTO mytable (id_num, myname) VALUES ('".$row["id_num"]."', '".$row["myname"]."')";
}
?>
[/code]
Yes I know it will need a little bit more coding than that, but the principle is there

Or is there another wicked function in mysql which will show the results like I want
Link to comment
https://forums.phpfreaks.com/topic/28430-mysql-backup/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.