Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts

    creating n inserting in to mysql using php via sql file

    can some one guide me to make a db query thru php with the info in a .sql file

    PHP Code:
    DROP TABLE IF EXISTS ip2nation;

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

    DROP TABLE IF EXISTS ip2nationCountries;
          
    CREATE TABLE ip2nationCountries (
      
    code varchar(4NOT NULL default '',
      
    country varchar(255NOT NULL default '',
      
    lat float NOT NULL default '0',
      
    lon float NOT NULL default '0',  
      
    PRIMARY KEY  (code),
      
    KEY code (code)
    );
    INSERT INTO ip2nation (ipcountryVALUES(0'us');
    INSERT INTO ip2nation (ipcountryVALUES(687865856'za');
    INSERT INTO ip2nation (ipcountryVALUES(699400192'eg');
    INSERT INTO ip2nation (ipcountryVALUES(699465728'za');
    INSERT INTO ip2nation (ipcountryVALUES(699531264'eg'); 
    how to access the sql file n insert it into the datbase...

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •