Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a .sql file containing the exporting of a database. I want to import this sql file using php script.
Suppose the database name is TESTDB and the sql file contains the following:
[syntax="sql"]-- phpMyAdmin SQL Dump
-- version 2.6.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 20, 2006 at 12:35 PM
-- Server version: 4.1.9
-- PHP Version: 4.3.10
--
-- Database: `community`
--
-- --------------------------------------------------------
--
-- Table structure for table `community_admin`
--
CREATE TABLE `community_admin` (
`adminId` int(10) NOT NULL auto_increment,
`username` varchar(200) NOT NULL default '',
`password` varchar(200) NOT NULL default '',
`name` varchar(200) NOT NULL default '',
`date` date NOT NULL default '0000-00-00',
`access` char(1) NOT NULL default '',
`status` char(1) NOT NULL default '',
PRIMARY KEY (`adminId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `community_admin`
--
INSERT INTO `community_admin` VALUES (1, 'admin', 'admin', 'Administrator', '2006-02-09', 'y', 'u');
-- --------------------------------------------------------
--
-- Table structure for table `community_pages`
--
CREATE TABLE `community_pages` (
`home` text NOT NULL,
`about` text NOT NULL,
`contact` text NOT NULL,
`webmasters` text NOT NULL,
`bookmark` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `community_pages`
--
INSERT INTO `community_pages` VALUES ('<P>this is test this is test this is test this is test this is test this is test this is test this is test this is test this is test this is test this is test this is test </P>\r\n<P> </P>\r\n<P>home page</P>', '<P>this is test </P>\r\n<P>about usccc</P>', '<P>this is test contact us</P>\r\n<P> </P>\r\n<P> </P>', '<P>this is test </P>\r\n<P>webmasters</P>', '<P>this is test </P>\r\n<P>bookmark</P>');
-- --------------------------------------------------------
--
-- Table structure for table `community_settings`
--
CREATE TABLE `community_settings` (
`site_name` varchar(200) NOT NULL default '',
`site_url` varchar(200) NOT NULL default '',
`admin_email` varchar(200) NOT NULL default '',
`results` varchar(100) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `community_settings`
--
INSERT INTO `community_settings` VALUES ('Community Website', 'http://demos.esolz.net/community/programming/', 'admin@community.com', '10');
-- --------------------------------------------------------
--
-- Table structure for table `community_user`
--
CREATE TABLE `community_user` (
`userId` int(15) NOT NULL auto_increment,
`firstname` varchar(200) NOT NULL default '',
`lastname` varchar(200) NOT NULL default '',
`email` varchar(200) NOT NULL default '',
`password` varchar(50) NOT NULL default '',
`dateofbirth` varchar(200) NOT NULL default '',
`gender` char(1) NOT NULL default '',
`profession` varchar(200) NOT NULL default '',
`country` varchar(200) NOT NULL default '',
`postcode` int(10) NOT NULL default '0',
`city` varchar(200) NOT NULL default '',
`nickname` varchar(200) NOT NULL default '',
`profileheading` varchar(255) NOT NULL default '',
`aboutyourself` text NOT NULL,
`profilelink` varchar(255) NOT NULL default '',
`bloglink` varchar(255) NOT NULL default '',
`link1` varchar(255) NOT NULL default '',
`link1pass` varchar(50) NOT NULL default '',
`link2` varchar(255) NOT NULL default '',
`link2pass` varchar(50) NOT NULL default '',
`link3` varchar(255) NOT NULL default '',
`link3pass` varchar(50) NOT NULL default '',
`link4` varchar(255) NOT NULL default '',
`link4pass` varchar(50) NOT NULL default '',
`status` char(1) NOT NULL default '',
PRIMARY KEY (`userId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `community_user`
--
INSERT INTO `community_user` VALUES (1, 'Atanu', 'Nandy', 'esolz_a.nandy@yahoo.co.in', '123456', '13_2_1980', 'M', 'S', '30', 100000, 'kolkata', 'Atanu_Nandy', 'Heading', 'Funny', 'http://atanu.com', 'http://atanu.com', '', '', '', '', '', '', '', '', 'u');Please give the related codes and suggestion.
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]