Въпрос за четене на MySQL

ragouster

Registered
Попаднаха ми доста sql файлове с разни рецепти, пиенета и много други неща.
Има ли начин с един скрипт да мога да ги разглеждам всичките, при условие, че всички са различни. Т.е. има база с рецепти с две таблици, и база с марки алкохол с три таблици и т.н. Един вид като има 50 бази данни да ги отварям която си поискам без да и въвеждам структурата.
Питам, защото във VB има такава възможност да се напише програмка и да ти отваря която и да е mdb база данни без да въвеждаш подробности, ама не мога да вдяна има ли такава възможност в PHP. То е най-лесно с phpMyAdmin, ама не се вижда нищо като хората.
 
Имам предвид, че sql файл мога да отворя и с ноутпад, и пак да видя какво има вътре. Но ща видя нещо такова:
CREATE TABLE `categories` (
`categoryid` int(10) unsigned NOT NULL default '0',
`category` varchar(100) default NULL,
PRIMARY KEY (`categoryid`),
UNIQUE KEY `categoryid` (`categoryid`),
KEY `categoryid_2` (`categoryid`)
) TYPE=MyISAM;

INSERT INTO `categories` VALUES (7, 'Hot Drinks');
INSERT INTO `categories` VALUES (1, 'Cocktails');
INSERT INTO `categories` VALUES (2, 'Non Alcoholic');
INSERT INTO `categories` VALUES (8, 'Beer');
INSERT INTO `categories` VALUES (4, 'Punches');
INSERT INTO `categories` VALUES (5, 'Frozen Drinks');
INSERT INTO `categories` VALUES (6, 'Shots');

CREATE TABLE `drinks` (
`drinkid` int(10) unsigned NOT NULL default '0',
`title` varchar(255) default NULL,
`directions` text,
`userid` int(10) unsigned default NULL,
`rating` int(10) unsigned default '0',
`categoryid` int(10) unsigned default NULL,
`date` varchar(20) NOT NULL default '',
`story` text,
`hits` int(10) unsigned default '0',
`status` char(1) default 'W',
PRIMARY KEY (`drinkid`),
UNIQUE KEY `recipieid` (`drinkid`),
KEY `recipieid_2` (`drinkid`)
) TYPE=MyISAM;

INSERT INTO `drinks` VALUES (4, 'Papa Smurf', 'Mix and chill vodka and kool-aid. Crush blue popsicle and add to mixture. The crushed popsicle should settle at the bottom of drink, making it appear as a blue layer at the bottom and a red layer on top. \r\n<BR>\r\n', 0, 5, 1, '10/13/2004', '', 189, 'L');
INSERT INTO `drinks` VALUES (3, 'Zombie', 'Shake all ingredients (except 151-proof rum) with ice and strain into a collins glass over ice cubes. Float the 151-proof rum on top, add a cherry (if desired), and serve.', 0, 2, 1, '10/13/2004', '', 37, 'L');

или такова:

CREATE TABLE `RECIPES_PRO_NEW` (
`Auto` INTEGER,
`Category` VARCHAR(255),
`Name` VARCHAR(255),
`Recipe` TEXT
) TYPE=MyISAM;

#
# Dumping data for table 'RECIPES_PRO_NEW'
#

INSERT INTO `RECIPES_PRO_NEW` VALUES (120, 'Appetizers', 'Apricot & Cucumber Soup', '<TABLE cellSpacing=2 cellPadding=3 border=0><TBODY><TR><TD><P>6 oz Dried apricots <P>1 1/2 pt Vegetable stock <P>1 ea Orange, juiced & rind grated <P>1 md Cucumber <P>1 md Onion, finely chopped <P>1 tb Vegetable oil <P>2 ts Curry powder <P>Salt & pepper 2 tb Pumpkin seeds, to garnish <P>Soak the apricots in the stock with the grated orange rind for 2 to 3 hours. Add the orange juice & simemr for 45 minutes. Cut 8 thin slices from the cucumber & reserve for garnish. Peel & roughly chop the remainder. Fry the onion in the oil over medium heat for 3 to 4 minutes, stirring once or twice. Stir in the curry powder & chopped cucumber & cook for 2 minutes. Puree the apricots with the stock & the cucumber mixture. Return to the pan & heat gently. Season with salt & pepper. Serve the soup garnished with floating slices of cucumber topped with the pumpkin seeds. Black rye bread makes a good accompaniment. Pamela Westland, \"Fruit\" <BR><BR></P></TD></TR></TBODY></TABLE>');
INSERT INTO `RECIPES_PRO_NEW` VALUES (121, 'Appetizers', 'Apricot Raisin Spread Davis', '<TABLE cellSpacing=2 cellPadding=3 border=0><TBODY><TR><TD><P>8 oz Cream cheese, cut into bits <P>-softened 1/2 c Apricot jam <P>1/2 c Golden raisins <P>-walnut halves, garnish In a food processor blend together the cream cheese and the jam until the mixture is smooth; add the raisins and pulse the motor until the mixture is just combined. Transfer the spread to a ramekin or small decorative bowl and chill it for 1 hour. Garnish the spread with the walnut halves and serve it with crackers. Makes about 1 1/2 cups. <BR><BR></P></TD></TR></TBODY></TABLE>');


Работата е в това, че sql файловете са над 300 и ако ми стигнат нервите да направя 300 БД, за всяка БД трябва да направя отделен скрипт който да я отвори и да ми я изведе на екрана в някакъв удобен вид. Табличен или просто echo. По просто би било с browse, и да отваря базата която си искаш и я преглеждаш. Не ми трябва нито да добавям, нито да трия, нито да редактирам. Просто оглед.
 

Back
Горе