₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,327,710 members, 8,432,212 topics. Date: Tuesday, 23 June 2026 at 12:14 PM

Toggle theme

Already Exist Remove From List - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingAlready Exist Remove From List (1413 Views)

1 Reply (Go Down)

Already Exist Remove From List by skyhighweb(op): 1:51pm On Apr 30, 2017
Am using php MySQL and i have a table which get filled, i want to be able to remove already selected data from list(frontend) automatically to avoid multiple selection and not having two of the same data in the table how do i go about this, thanks.

for example, if on the drop menu we have

mike
Jacob
Steve
David

if someone already selected David i don't want him to show up on the list

plz note i already have already exist code, i just need to know how not to show it, thanks
Re: Already Exist Remove From List by lovely8(m): 2:53am On May 01, 2017
I am a master in Website designing and programming , i acquired a lot of skills and have many years experience , i have build a lot of Website for people over the years , their is no Website available on earth that i can't build, i also build android and Apple ios App, bring your Work to me and you will be glad you did. I will show you the latest Website i build this year. WhatsApp or call 0.9.0.3.3.1.0.4.1.3.4
Re: Already Exist Remove From List by roadsta(m): 12:29pm On May 01, 2017
var array = ['a', 'b', 'a', 'c', 'a', 'd'];
// the list
var element = 'a';
// selected element
var idx = array.indexOf(element);
// first find the element index
while (idx != -1) {
// this makes sure the element is defined in the list
array.splice(index, 1);
// this return a new list without the selected element
}

Note that this wont work in older browsers like ie 7 but if you target such, you can use polyfills.
Re: Already Exist Remove From List by skyhighweb(op): 12:40pm On May 01, 2017
roadsta:
var array = ['a', 'b', 'a', 'c', 'a', 'd'];
// the list
var element = 'a';
// selected element
var idx = array.indexOf(element);
// first find the element index
while (idx != -1) {
// this makes sure the element is defined in the list
array.splice(index, 1);
// this return a new list without the selected element
}

Note that this wont work in older browsers like ie 7 but if you target such, you can use polyfills.
looks like javascript
Re: Already Exist Remove From List by roadsta(m): 3:33pm On May 01, 2017
^^
Oh yes! it is javascript. Just translate it to favourite language, But if you can´t do it.
tell me your favourite
language
skyhighweb:
looks like javascript
Re: Already Exist Remove From List by vicsrael: 3:42pm On May 01, 2017
skyhighweb:
Am using php MySQL and i have a table which get filled, i want to be able to remove already selected data from list(frontend) automatically to avoid multiple selection and not having two of the same data in the table how do i go about this, thanks.

for example, if on the drop menu we have

mike
Jacob
Steve
David

if someone already selected David i don't want him to show up on the list

plz note i already have already exist code, i just need to know how not to show it, thanks
Select unique columnname from table or if u need more than one column and u don't want a particular column to repeat value use select * from table group by norepeatcolumnname
Re: Already Exist Remove From List by skyhighweb(op): 5:06pm On May 01, 2017
roadsta:
^^
Oh yes! it is javascript. Just translate it to favourite language, But if you can´t do it.
tell me your favourite
language
php
Re: Already Exist Remove From List by skyhighweb(op): 5:07pm On May 01, 2017
vicsrael:
Select unique columnname from table or if u need more than one column and u don't want a particular column to repeat value use select * from table group by norepeatcolumnname
not asking about that
Re: Already Exist Remove From List by vicsrael: 8:32pm On May 01, 2017
skyhighweb:
not asking about that
Explain better than
Re: Already Exist Remove From List by skyhighweb(op): 10:42pm On May 01, 2017
vicsrael:
Explain better than
how can i make a selected data not show up in list anymore.
for example on the list are
steve
mike
dave
moses
if someone select dave i dont want it to show up on the list anymore. hope u understand.
Re: Already Exist Remove From List by roadsta(m): 11:49pm On May 01, 2017
skyhighweb:
php
In that case all you need to do is :

- grab the value from the array
- then call unset($value) to remove it
Re: Already Exist Remove From List by skyhighweb(op): 6:13am On May 02, 2017
roadsta:
In that case all you need to do is :

- grab the value from the array
- then call unset($value) to remove it
okay how do i do that, am not fully sure which code to edit or add
Re: Already Exist Remove From List by roadsta(m): 8:44am On May 02, 2017
skyhighweb:
okay how do i do that, am not fully sure which code to edit or add
Try to be more elaborate in your questions(detailed information) if you want an elaborate answer.
O.k Lets see an example :

From your initial post,i understaood that you have a list of names like "array(mike, jacob, steve, David); right?

If so, all you have to do is iterate through the list, grab the selected element in the list and remove with the unset fuction passing in the key :

As an example:

$users = [mike, jacob, steve, david];

foreach($users as $key=>$val)
{
if ($val==david) unset($names[$key]);
}
print_r($users);

I hope this should help solve the problem.
Re: Already Exist Remove From List by skyhighweb(op): 12:27pm On May 02, 2017
roadsta:
Try to be more elaborate in your questions(detailed information) if you want an elaborate answer.
O.k Lets see an example :

From your initial post,i understaood that you have a list of names like "array(mike, jacob, steve, David); right?

If so, all you have to do is iterate through the list, grab the selected element in the list and remove with the unset fuction passing in the key :

As an example:

$users = [mike, jacob, steve, david];

foreach($users as $key=>$val)
{
if ($val==david) unset($names[$key]);
}
print_r($users);

I hope this should help solve the problem.
i sent u a mail
1 Reply

Already Exist Dont Display 3000 k naira for who can solve itRemove Already Seleted Data From ListAlready Exist Remove From List234

Laravel Ninjas Lets Meet HerePlease Assist In Designing This AppLaravel Vuejs Video Manager Application Tutorial Series