-
Advanced PHP Question
Hello,
I'm not good at stepping slowly through data and matching strings, etc. I've created a PHP engine where I type a code such as flashkit.allrows and coding takes that and replaces it with a database result set. This allows users to request database data without having to know advanced code.
I want to take it one step further. Say I want them to type flashkit.company[2], where the code would grab the company information from the database with ID # 2.
So I need to:
Find flashkit.company[IDHERE]
Somehow extract the IDHERE part and use that data to query the database.
I can figure out the rest.
Thanks ahead of time!
Clint
-
Answered my own question, for those who might be interested:
<?
$string = 'Happy birthday [fkf.partner]1463[END fkf.partner] happy go lucky!';
$first = strpos($string, '[fkf.partner]') + 13;
$second = strpos($string, '[END fkf.partner]');
$totallength = $second - $first;
$extractednumber = substr($string, $first, $totallength);
?>
<?= $first ?>
<br><?= $second ?>
<br><?= $extractednumber ?>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|