I'm kind of new at php and need to parse a url: http://www.someurl.com/directory/214 and use the last digists as a ID. Finally inserting that ID into a mysql db.

Any help would be greatly appreciated..

Thanks..

Tee214..:bemused:

    The mod_rewrite suggestions assume that the URL in question is the URL of the script being executed. If that is not the case, but you are instead just parsing a URL from some other source, then [man]basename/man might be the simplest solution.

    <?php
    $url = 'http://www.someurl.com/directory/214';
    $id = basename($url);
    echo $id;
    

      Don't forget to mark this thread resolved (if it is).

        Write a Reply...