jkewlo Posted May 19, 2009 Share Posted May 19, 2009 Hey!, So i seen the reg area here and have been posting in the php help section, well anyways, what I want to do is grab certain lines from a txt file the text file is like this 501# A potion made from ground Red Herbs that restores ^000088about 45 HP^000000. ^ffffff_^000000 Weight :^777777 7^000000 # the 501 is the ID it also matches the ID in the mysql table then the description which is really what i want to grab via the id the weight i dont really care about being it is already in the database. where the description is not. I was told to use preg_match this is what I have $file = file_get_contents('idnum2itemdesctable.txt'); $array = explode("". $row->id ."", $file); $random = rand(1 + 6 - 5, count($array)); $desc = $array[$random]; which will display at random. but I need it to display by the ID as shown above. if anyone can show me a example that would be awesome Link to comment https://forums.phpfreaks.com/topic/158670-preg_match-to-match-a-whaaa/ Share on other sites More sharing options...
.josh Posted May 19, 2009 Share Posted May 19, 2009 thread closed. You already have a thread asking the same question. The answer was already given to you, to boot. Go back and reread it. Again. And again. Link to comment https://forums.phpfreaks.com/topic/158670-preg_match-to-match-a-whaaa/#findComment-836867 Share on other sites More sharing options...
Recommended Posts