/    Sign up×
Community /Pin to ProfileBookmark

array challenge

Hi the below code works except I want I’m having a hard time setting the value for “relation”. the value of $value is returning family[100]. I only want the word ‘family’ and drop the key value.

any ideas how to do this

[code]
$except_request = $_POST[‘relationship’];

if(isset($_POST[‘except_request’])){
if(is_array($except_request)) {
foreach($except_request as $key=>$value){

mysql_query (“UPDATE buddylink SET relation =’$value’, status=’2′ WHERE buddylink_id = ‘$key'”)or die(“SQL Error:” . mysql_error());
}
[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ss1289Feb 10.2008 — Use the php function preg_split() or split() to separate the string.
×

Success!

Help @kproc 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 5.17,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...