homie_g Posted August 20, 2003 Share Posted August 20, 2003 how do i use a .sql file to create database(s) and tables? Link to comment https://forums.phpfreaks.com/topic/922-insert-sql/ Share on other sites More sharing options...
DylanBlitz Posted August 20, 2003 Share Posted August 20, 2003 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 Link to comment https://forums.phpfreaks.com/topic/922-insert-sql/#findComment-3069 Share on other sites More sharing options...
homie_g Posted August 20, 2003 Author Share Posted August 20, 2003 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? Link to comment https://forums.phpfreaks.com/topic/922-insert-sql/#findComment-3072 Share on other sites More sharing options...
DylanBlitz Posted August 20, 2003 Share Posted August 20, 2003 are you using phpmyadmin? if you are then it defaults to db.sql Link to comment https://forums.phpfreaks.com/topic/922-insert-sql/#findComment-3073 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.