473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with simple code

Hello there,

Little problem I can't solve. Its seems easy but I can't find out a simple
solution. Maybe a clever way already exists:

I've a site where people may have up to 5 pictures.
They can add, remove, change pictures as they want. The problem is when
users remove pictures at beginning and in the middle.

User X uploads 5 pictures.
Then he decides to remove picture 1 and 3.
Actually the resulting pictures are 2, 4 and 5.

I want to move (by renaming) the pictures to have finally 1,2,3

How can I do this ? Pseudo code would be great, as Actually I'm trying to
look in 2 array to keep trace where they are free slots and used pictures
and trying a complex move between array. Isn't a good way, I know, but I
can't find a easy way.

Bob

Mar 8 '06 #1
4 1143
Well the siplest way ( I think ) would be to include the shifting
process into the delete function. So when you delete image 2 then you
will run through a loop that runs from 3-5 and shift them all so the
result will be 2-4. BUt since I dod not quite know how your code is (
if you allow more than 1 deletation at a time ) I can not quite tell
you the solution, since if you are deleting2 files at a time you have
to run the proccess 2 times ( or something like that ).

Hope this answares some of your questions ( although it raised some
more in my mind, :p ), and hope I undestood your question. :)

Ásgeir

Mar 8 '06 #2
<go****@gmail.com> a écrit dans le message de news:
11**********************@z34g2000cwc.googlegroups. com...
Well the siplest way ( I think ) would be to include the shifting
process into the delete function. So when you delete image 2 then you
will run through a loop that runs from 3-5 and shift them all so the
result will be 2-4. BUt since I dod not quite know how your code is (
if you allow more than 1 deletation at a time ) I can not quite tell
you the solution, since if you are deleting2 files at a time you have
to run the proccess 2 times ( or something like that ).

Hope this answares some of your questions ( although it raised some
more in my mind, :p ), and hope I undestood your question. :)

Thanks for your answer...

It's finally done, with less than 10 lines of php code...

Mar 8 '06 #3
NIce hope my answare helped u a little.. ;)

Mar 9 '06 #4
<go****@gmail.com> a écrit dans le message de news:
11*********************@v46g2000cwv.googlegroups.c om...
NIce hope my answare helped u a little.. ;)


Of course it did !

Thanks for your help.

Bob

Mar 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Jeff Wagner | last post by:
I am in the process of learning Python (obsessively so). I've been through a few tutorials and read a Python book that was lent to me. I am now trying to put what I've learned to use by rewriting...
10
by: george young | last post by:
For each run of my app, I have a known set of (<100) wafer names. Names are sometimes simply integers, sometimes a short string, and sometimes a short string followed by an integer, e.g.: 5, 6,...
11
by: Jim | last post by:
Hi, I keep getting form results emailed to me that would indicate a form from my web site is getting submitted with all fields blank or empty, but my code should preventing users from proceeding...
7
by: Jack Addington | last post by:
I've got a fairly simple application implementation that over time is going to get a lot bigger. I'm really trying to implement it in a way that will facilitate the growth. I am first writing a...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
8
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
25
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of...
1
by: vikjohn | last post by:
I have a new perl script sent to me which is a revision of the one I am currently running. The permissions are the same on each, the paths are correct but I am getting the infamous : The specified...
0
by: jerger | last post by:
I posted this in ASP... does it belong here instead? I have converted my dictionary program into a simple asp program. It works great... but I now want to add speech functionality but have not had...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.