Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,550 members, 7,819,949 topics. Date: Tuesday, 07 May 2024 at 07:19 AM

Already Exist Remove From List - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Already Exist Remove From List (1169 Views)

Already Exist Dont Display 3000 k naira for who can solve it / Remove Already Seleted Data From List / Already Exist Remove From List (2) (3) (4)

(1) (Reply) (Go Down)

Already Exist Remove From List by skyhighweb(m): 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(m): 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(m): 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(m): 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(m): 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(m): 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(m): 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)

Implement The Quick Sort Algorithm In Your Language. / Html Novice / How To Get Cpanel Software

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.