jorgen_100 Posted February 17, 2007 Share Posted February 17, 2007 Hi all, Just arrived on this forum and in PHP/MySQL country. I am having a problem, and know to little to solve this. I want to put some data in a Mysql database from a large text field, but not all data which will be submitted. this is the data what will be put in the text field, http://www.vr6blackwidow.nl/jorgen/test.txt and i only want a few things put into the database, like rank progress, bullets and a few other things I know how to make the connection and put text boxes into a database but i have no clue how to pick a few lines out the text field and add it to the database, and no idea if it is even possible. Could someone push me in the right direction? Cheers Jorgen Link to comment https://forums.phpfreaks.com/topic/38885-newbie-quistion/ Share on other sites More sharing options...
o3d Posted February 17, 2007 Share Posted February 17, 2007 You could loop through all lines in the file and find the lines you are looking for by using preg_match while looping through lines you could use something similiar to: while (!eof) { if (preg_match("/Honour points/i", $CurrentFileLine)) { //match was found //do character handling (explode or somtin) to store the value after the Honour points e.g. $Value = substr($CurrentFileLine, strpos($CurrentFileLine, "Honour points")+strlen("Honour points"), strlen($CurrentFileLine) - strpos($CurrentFileLine, "Honour points")+strlen("Honour points"); } } Hope this helps. Link to comment https://forums.phpfreaks.com/topic/38885-newbie-quistion/#findComment-187015 Share on other sites More sharing options...
jorgen_100 Posted February 20, 2007 Author Share Posted February 20, 2007 Thanks for the Reply. Seems i need to learn a lot more before i can make what i want, but requested some books at the library Link to comment https://forums.phpfreaks.com/topic/38885-newbie-quistion/#findComment-189815 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.