Jump to content

Archived

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

homie_g

Insert .sql

Recommended Posts

a .sql file is basically a flat text file that will create your tables and insert data when you put yoru fields in. Mostly what I\'ve used them for is backup. I load phpmyadmin, click export, and then export a .sql file which will create everything again if it goes down. Here is a sample of some stuff.

 

You create the db on your own, then here is a table:

 

 


DROP TABLE IF EXISTS `button`;

CREATE TABLE `button` (

 `butt_id` int(11) NOT NULL auto_increment,

 `butt_name` varchar(150) NOT NULL default \'\',

 `butt_action` varchar(150) default NULL,

 `butt_link` varchar(150) NOT NULL default \'\',

 PRIMARY KEY  (`butt_id`)

) TYPE=MyISAM AUTO_INCREMENT=64;

That tells the mysql that if the db already has a \"button\" table to get rid of it and create one with these fields. Then you insert data into it:

 


INSERT INTO `button` VALUES (10, \'News - Add\', \'add\', \'admin_news.php\');

INSERT INTO `button` VALUES (11, \'News - Modify\', \'modify\', \'admin_news.php\');

INSERT INTO `button` VALUES (12, \'News - Delete\', \'delete\', \'admin_news.php\');

 

Hope that helps you. If it\'s not what you meant then let me know :)

Share this post


Link to post
Share on other sites

thanx.

 

 

im using mysql on my harddrive for testing etc. and im i n00b :oops:

 

i no how to import from a .txt file but how to do export to a .txt file?

Share this post


Link to post
Share on other sites

×

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.