/    Sign up×
Community /Pin to ProfileBookmark

Deleting more than one user in database.

This might be a dumb question, how do you delete more than one user from a database.

Say on the page there are three users display, they each have a check box next to the name which they select to delete.

User 1 []
User 2 []
User 3 []

Say the check box group name is Delete_Box

If I click on all 3, how will the database know what to delete, what I mean by that, if each box has a different value, won’t it parse all the data together? What I mean is, say user 1 box is value=”1″, then 2 etc…so when I click submit, won’t it say 123 then it can’t find 123 in the database, but user 1, 2, 3 submitted as seperate values individual would work. I hope I explained it simple enough.

-DB

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@pyroDec 10.2004 — What does your HTML look like? This for example:

<input type="checkbox" name="id[]" value="1" />
<input type="checkbox" name="id[]" value="2" />
<input type="checkbox" name="id[]" value="3" />


Would pass an array of all the checked items to your PHP code. You could then loop through the array and delete.
Copy linkTweet thisAlerts:
@d_brandusaauthorDec 10.2004 — Yes, it looks just like that.
Copy linkTweet thisAlerts:
@pyroDec 10.2004 — Then let's see your PHP code, please.
Copy linkTweet thisAlerts:
@BuezaWebDevDec 10.2004 — Hrmm, Yes, I would like to know how to make an array in PHP.

In java, it's

[code=php]
for (int i = 0; i < arrayName.size; i++)
{
System.out.println(arrayName[i]);
}

[/code]


what's the equivelent for php?
Copy linkTweet thisAlerts:
@Ben_RogersDec 11.2004 — Well, I don't know Java, but the [url=http://us2.php.net/function.array]array()[/url] function is used to create PHP arrays...
Copy linkTweet thisAlerts:
@BuezaWebDevDec 11.2004 — ohhhhh, I understand now. ?
×

Success!

Help @d_brandusa 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.18,
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,
)...