...

View Full Version : creating n inserting in to mysql using php via sql file



hmvrulz
02-23-2008, 07:46 AM
can some one guide me to make a db query thru php with the info in a .sql file


DROP TABLE IF EXISTS ip2nation;

CREATE TABLE ip2nation (
ip int(11) unsigned NOT NULL default '0',
country char(2) NOT NULL default '',
KEY ip (ip)
);

DROP TABLE IF EXISTS ip2nationCountries;

CREATE TABLE ip2nationCountries (
code varchar(4) NOT NULL default '',
country varchar(255) NOT NULL default '',
lat float NOT NULL default '0',
lon float NOT NULL default '0',
PRIMARY KEY (code),
KEY code (code)
);
INSERT INTO ip2nation (ip, country) VALUES(0, 'us');
INSERT INTO ip2nation (ip, country) VALUES(687865856, 'za');
INSERT INTO ip2nation (ip, country) VALUES(699400192, 'eg');
INSERT INTO ip2nation (ip, country) VALUES(699465728, 'za');
INSERT INTO ip2nation (ip, country) VALUES(699531264, 'eg');


how to access the sql file n insert it into the datbase...

_Aerospace_Eng_
02-23-2008, 08:08 AM
Just use php to run the queries. Why are you trying to access the sql file with php? You could also install phpmyadmin and then run the sql that way which would be a lot easier.

hmvrulz
02-23-2008, 12:19 PM
Just use php to run the queries. Why are you trying to access the sql file with php? You could also install phpmyadmin and then run the sql that way which would be a lot easier.

yes.. i am creating it so tht even some one who doesnt knows programming can use the script



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum