/    Sign up×
Community /Pin to ProfileBookmark

removal of string characters

Hi.. I have various URL’s in a database that I want to trim before I display them. I was using the SELECT RIGHT(URL,8) method, however this is only useful if I want to keep the final 8 characters. I actually want the characters at the end of the string that immediately follow an “=” sign, but they will very with length, depending on the URL.

eg.URL1. /index…=id=24495659
eg.URL2. /index…=id=the_one_and_only

Does anyone have any ideas about how I might tackle this?

Many thanks,

Peter

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@rch10007Apr 05.2006 — read this: http://php.net/manual/en/function.preg-replace.php

i can't help much more than that because i am still trying to understand this stuff myself.
Copy linkTweet thisAlerts:
@NogDogApr 05.2006 — [code=php]
$test = "http://www.somewhere.com/index.html?id=testing123";
$url = parse_url($test);
parse_str($url['query'], $urlQuery);
echo $urlQuery['id'];
[/code]
×

Success!

Help @mojobullfrog spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...