ashworthm Posted January 25, 2007 Share Posted January 25, 2007 Hi everyone, i am very new to php and sql. I am having trouble in getting a script to upload info into my sql table. I have got an upload form sorted but just cannot get my hands on a script to load the data into the sql table. Does anyone have one that i can just alter the fields?any help will be welcomed.thanks Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/ Share on other sites More sharing options...
Cep Posted January 25, 2007 Share Posted January 25, 2007 Hello,I am a little unsure of how your question relates to the table but here goes,If you have an html form which accepts user input via textboxes etc you can pass these to PHP and then use SQL statements to insert this data into a database.If you have an html form which uploads a file you will then need to create a script which can read the file, best formats are CSV, XML or even plain text but that gets messy and then you can pass this data to a database again via SQL statements. Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/#findComment-168841 Share on other sites More sharing options...
ashworthm Posted January 25, 2007 Author Share Posted January 25, 2007 Hi Cep, sorry for any confusion in my initial question, i have a table in sql which holds x amount of rows, how do i upload a text file into that table but through php\html instead of going through the mysql screen?CheersMatt Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/#findComment-168886 Share on other sites More sharing options...
Cep Posted January 25, 2007 Share Posted January 25, 2007 Your still confusing me, lets work through what you say you have.1. You have a table in SQL with rows of data, is this in your MySQL database?2. You have a text file, containing what? what is the text file? what is it for?3. You want the physical text file in the table? OR you want the data in that text file in the table or a new table?4. Which MySQL screen are we talking? Do you mean the command line interface on MySQL server? or are you referring to PHPMyAdmin? Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/#findComment-168901 Share on other sites More sharing options...
ashworthm Posted January 25, 2007 Author Share Posted January 25, 2007 hi,1.yes, i have a table in mysql database with rows setup but no info in them yet.2.i have a comma delimited text file which i want to upload into the sql database3.i want the contents of the text file in the sql database4.the sql screen i mentioned was phpmyadmin.hope this helps Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/#findComment-168904 Share on other sites More sharing options...
Jenk Posted January 25, 2007 Share Posted January 25, 2007 In console:1. upload the CSV via ftp2. login to mysql3. issue command:[code]LOAD DATA LOCAL INFILE "/path/to/csv/file"INTO TABLE `table`FIELDS TERMINATED BY ","LINES TERMINATED BY "\r\n";[/code]Via the web: 1. use phpmyadmin: http://www.phpmyadmin.net/home_page/index.php Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/#findComment-168916 Share on other sites More sharing options...
ashworthm Posted January 25, 2007 Author Share Posted January 25, 2007 cheers, will give this ago. Link to comment https://forums.phpfreaks.com/topic/35646-upload-an-excel-or-text-file-into-sql-table/#findComment-168921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.