Jump to content

does readdir not read it in numerical order ?


pooker

Recommended Posts

here is some of my basic code

 

while($folder = readdir($dir)  ){

if ($folder != '.' && $folder != '..') {

$number = $number +1;

?>

<option value="<? echo $folder ?>">chapter <? echo $number ?></option>

<?

}

}

 

in the next page it uses echo folder to reference the image like this

 

img src = /mangareadr/$series/$folder/$number.png 

 

dont worry about the way the code looks because I was just wrighting a short example, and the code works with passing and everything my problem is the way it readdir reads the folder. 

 

In the folder here is how it is setup

 

chapter1

chapter2

chapter3

etc,....

 

So you would assum it would read it like that right?  Well it doesn't, readdir reads mine backwords for some reason so if a user clicks on chapter 4 it would give them chapter 1, chapter 3 would give them chapter 2 and so on in reverse order.  Because I used the number incrementer to increase in number I thought this would work but it does not.  Hop that is clear and thanks for the help ^^

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.