Jump to content

Preg_match to match a Whaaa??


jkewlo

Recommended Posts

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
Share on other sites

Guest
This topic is now 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.