Jump to content

Newbie quistion


jorgen_100

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.