Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting from an Array

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
HI,

I am trying to delete an element in an Array, however the problem is never straight forward.

I have a 2 dimensional Array which is populated with products such as id, description etc. These are then displayed from the Array into a table. Beside each row/product displayed is an update and delete button created for each product in each row, generated within a loop. I want to be able to click on the delete button and then the product in that row is deleted from the array? I really have no idea how to go about this. Any ideas would be super.

p.s I am not sure where within the button I would type the code as I have tried typing code after the A href checkput.cfm? and get an error as I take it it starts from the top of the page and goes through the code again resulting in error in the arrays.

The code for the buttons is given below:<A
href=&quot;detail.cfm&quot;
target=mainFrame><IMG border=0 height=28 name=Image13
src=&quot;checkout_files/prod_update.gif&quot; width=67></A> </TD>
<TD align=right width=70> <A
href=&quot;checkout.cfm?&quot;target=mainFrame>
<IMG border=0 height=28 name=Image2 src=&quot;checkout_files/remove.gif&quot;
width=67></TD></TR>
<TR>
<TD colSpan=10><IMG height=5 src=&quot;checkout_files/shim.gif&quot;
width=20></TD></TR></TBODY></TABLE>

 
If you cn do it, try using lists instead of arrays. They are easier to work with (although if you replace one 2 dimensional array you will need to use two lists) as there are list manipulation techniques such as listgetat and listdelat (or that one may be listdeleteat - not sure) which will accomplish what you want. You can also use the lists for looping to create your table also.

Simon
 
or you can also read the doc - especially for the ArrayDeleteAt() function ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top