Jump to content

Insert .sql


homie_g

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.