jana Posted September 26, 2006 Share Posted September 26, 2006 I am new to php and i want to insert a text file into mysql. i hav created the table temp_tableTemp_Tablec_date varchar(10)I_time varchar(4)O_Time varchar(4)empcode varchar(7)and the text file contains the data like this[color=red]12062006[/color][color=green]0920[/color][color=blue]1004[/color]120620062212100412062006081611561206200620451156and i want to split each line and insert into the table by [color=red]12062006 as c_date[/color][color=green]0920 as I_Time[/color][color=blue]1004 as empcode.[/color]can anyone solve this? Link to comment https://forums.phpfreaks.com/topic/22082-how-to-fetch-the-below-data-into-mysql/ Share on other sites More sharing options...
alpine Posted September 26, 2006 Share Posted September 26, 2006 look at substr() to split stringhttp://no.php.net/manual/en/function.substr.phpand explode() to get each line by exploding \n (or \r)http://no.php.net/manual/en/function.explode.php Link to comment https://forums.phpfreaks.com/topic/22082-how-to-fetch-the-below-data-into-mysql/#findComment-98825 Share on other sites More sharing options...
jana Posted September 26, 2006 Author Share Posted September 26, 2006 can u tell me how to open a text file in php and how to fetch each line. Link to comment https://forums.phpfreaks.com/topic/22082-how-to-fetch-the-below-data-into-mysql/#findComment-98828 Share on other sites More sharing options...
prabhuraman Posted September 26, 2006 Share Posted September 26, 2006 hello jana, muself prabhuraman i am too new to php, can we both join and study php together... Link to comment https://forums.phpfreaks.com/topic/22082-how-to-fetch-the-below-data-into-mysql/#findComment-98834 Share on other sites More sharing options...
jana Posted September 26, 2006 Author Share Posted September 26, 2006 yes sure Link to comment https://forums.phpfreaks.com/topic/22082-how-to-fetch-the-below-data-into-mysql/#findComment-98845 Share on other sites More sharing options...
shoz Posted September 26, 2006 Share Posted September 26, 2006 [quote author=jana link=topic=109523.msg441586#msg441586 date=1159266943]can u tell me how to open a text file in php and how to fetch each line.[/quote][url=http://www.php.net/file]file()[/url] Link to comment https://forums.phpfreaks.com/topic/22082-how-to-fetch-the-below-data-into-mysql/#findComment-98855 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.