...

View Full Version : PHP setup script can't load sql file



moos3
03-13-2008, 01:42 AM
I have a sql file that contains everything that is needed to setup the web application. All it is a php mysql dump I have the following function


// Populate Database using SQL file
function popData(){
$path = 'sql_setup.sql';
$f = fopen($path,"r");
$file = fread($f,filesize($path));
$results = $this->connectDB($file);
echo '<div class="done"><div id="notice">Database Seccussfully populated</div></div>';
}

when I dump the $results all i get is bool(false) ideas? heres teh sql file


--
-- Table structure for table `content`
--

DROP TABLE IF EXISTS `content`;
CREATE TABLE `content` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(160) default NULL,
`body` text,
`author_id` int(11) default NULL,
`slug` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `content`
--

INSERT INTO `content` (`id`, `title`, `body`, `author_id`, `slug`) VALUES
(1, 'Clan Information', 'Clan Information will be here', 1, 'Clan-Information');

-- --------------------------------------------------------

--
-- Table structure for table `member_profiles`
--

DROP TABLE IF EXISTS `member_profiles`;
CREATE TABLE `member_profiles` (
`id` int(11) NOT NULL auto_increment,
`team_member_id` int(11) default NULL,
`background` text,
`aim` varchar(80) default NULL,
`gtalk` varchar(80) default NULL,
`yahoo` varchar(80) default NULL,
`website` varchar(160) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `team_member_id` (`team_member_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `member_profiles`
--


-- --------------------------------------------------------

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int(11) NOT NULL auto_increment,
`name` char(80) default NULL,
PRIMARY KEY (`id`),
KEY `roles_id_idxfk` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`) VALUES
(1, 'admin'),
(2, 'member');

-- --------------------------------------------------------

--
-- Table structure for table `team_members`
--

DROP TABLE IF EXISTS `team_members`;
CREATE TABLE `team_members` (
`id` int(11) NOT NULL auto_increment,
`member_name` varchar(80) default NULL,
`member_email` varchar(160) default NULL,
`gamerTag` varchar(80) default NULL,
`rank_id` int(11) default NULL,
`password` varchar(255) default NULL,
`salt` varchar(255) default NULL,
`role_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `team_members_id_idxfk` (`id`),
KEY `role_id` (`role_id`),
KEY `rank_id` (`rank_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `team_members`
--


-- --------------------------------------------------------

--
-- Table structure for table `team_rank`
--

DROP TABLE IF EXISTS `team_rank`;
CREATE TABLE `team_rank` (
`id` int(11) NOT NULL auto_increment,
`rank` varchar(255) default NULL,
`short_name` char(8) default NULL,
`rank_icon` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `team_rank_id_idxfk` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;

--
-- Dumping data for table `team_rank`
--

INSERT INTO `team_rank` (`id`, `rank`, `short_name`, `rank_icon`) VALUES
(1, 'Commander', 'XO', NULL),
(2, 'General', 'Gen', NULL),
(3, 'Lieutenant General', 'Lt Gen', NULL),
(4, 'Major General', 'Maj gen', NULL),
(5, 'Brigadier General', 'Brig Gen', NULL),
(6, 'Colonel', 'Col', NULL),
(7, 'Lieutenant Colonel', 'Lt Col', NULL),
(8, 'Major', 'Maj', NULL),
(9, 'Captain', 'Capt', NULL),
(10, 'First Lietenant', '1st Lt', NULL),
(11, 'Second Lieutenant', '2nd Lt', NULL),
(12, 'Master Gunnery Sergeant', 'MGySgt', NULL),
(13, 'Sergeant Major', 'SgtMaj', NULL),
(14, 'Master Sergeant', 'Msgt', NULL),
(15, 'Gunnery Sergeant', 'GySgt', NULL),
(16, 'Staff Sergeant', 'SSgt', NULL),
(17, 'Sergeant', 'SGT', NULL),
(18, 'Corporal', 'CPL', NULL),
(19, 'Lance Corporal', 'LCpl', NULL),
(20, 'Private First Class', 'PFC', NULL);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum