dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Advanced PHP Question

  1. #1
    Wannabe PHP Wizard
    Join Date
    Nov 2001
    Location
    Leechburg, PA
    Posts
    129

    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
    Clinton N Godlesky
    My Stuff:
    http://www.15656.com/clint http://www.statedirt.com
    Personal Development Projects:
    http://www.15656.com/dev

  2. #2
    Wannabe PHP Wizard
    Join Date
    Nov 2001
    Location
    Leechburg, PA
    Posts
    129
    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 ?>
    Clinton N Godlesky
    My Stuff:
    http://www.15656.com/clint http://www.statedirt.com
    Personal Development Projects:
    http://www.15656.com/dev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center