dougal85
-
Posts
10 -
Joined
-
Last visited
Never
Posts posted by dougal85
-
-
[!--quoteo(post=371808:date=May 6 2006, 02:04 PM:name=Dougal Matthews)--][div class=\'quotetop\']QUOTE(Dougal Matthews @ May 6 2006, 02:04 PM) [snapback]371808[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I've done a directory listing, but i only want it to show certain file types. I cant figure out how to find the file extension?
The only function i have found is filetype() but it returns directory/files etc. rather than the extension.
is the only way to do it by examining the name and putting out the extension? Not quite sure how to do that either... thanks for the help
[/quote]
got it ! :)
[a href=\"http://uk.php.net/pathinfo\" target=\"_blank\"]http://uk.php.net/pathinfo[/a] -
[!--quoteo(post=371782:date=May 6 2006, 08:03 AM:name=Ames)--][div class=\'quotetop\']QUOTE(Ames @ May 6 2006, 08:03 AM) [snapback]371782[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thanks for you help
i have already got this statement:
$query = "SELECT * FROM events ORDER BY Date"; date being my field and events being the table. So when u say id that would be eventid for me, as that is my primary key field. So that simple query, will keep updating new events that are added to my database? thanks! Amy!
[/quote]
SELECT * FROM events ORDER BY Date DESC LIMIT 0, 10
will give you the most recent 10 assuming you have a date field with the date of when its posted.
LIMIT works like this : LIMIT starting number, count
ie.
LIMIT 0, 10 - starts at 0 gives you 10 - records 0 - 9
LIMIT 4, 5 - Starts at result 4 and gives you 4 - records 4 - 9 -
I've done a directory listing, but i only want it to show certain file types. I cant figure out how to find the file extension?
The only function i have found is filetype() but it returns directory/files etc. rather than the extension.
is the only way to do it by examining the name and putting out the extension? Not quite sure how to do that either... thanks for the help -
also realised that;
(x-1, y+1) only needs start from the elements on the left and top
(x+1, y+1) only needs to start on the elements on the left and bottom.
just coding it now, fingers crossed -
[!--quoteo(post=368807:date=Apr 26 2006, 01:19 PM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Apr 26 2006, 01:19 PM) [snapback]368807[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hello,
as i said,
u need not check arr ( x-1, y-1 ) and arr ( x+1, y-1 ) , so u will not check repeatedly....:) ...give it a shot, i think it should work.
hth
[/quote]
sorry i didnt see that!
Thanks, i'm just going to give it a shot now - i'll let you know how i get on. -
[!--quoteo(post=368792:date=Apr 26 2006, 12:22 PM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Apr 26 2006, 12:22 PM) [snapback]368792[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hello,
I am not sure if i understand it correctly. still no harm in trying....
to check for any diagonal elements, you will have to navigate thru each element of the array and check diagonal elements for each.
example : suppose the current array element u r checking is
arr( x , y )
the possible digonal elements are
arr ( x-1, y-1 )
arr ( x+1, y-1 )
arr ( x-1, y+1 )
arr ( x+1, y+1 )
out of which i think you need not check for arr ( x-1, y-1 ) and arr ( x+1, y-1 ) as while navigating if you start from x=0,y=0 these 2 elements would have been already checked. so u need to check only the remaining 2 elements. if any of these 2 is same as the arr( x , y ) then you have ur diagonals
hth
sorry if i confused u more :) was just trying to help :)
[/quote]
omg, thats actually a really good idea. I think i can see how that would works, since i know the upper and lower limits i think i should be able to get some sort of loop to go through all that.
The only thing is it will probably end up checking all the diagonals multiple times but i could put it in my documentation that its doing that just to be sure! hehe :)
hmm, guess i could try and work it out to see what the minimum number of elements i would need to check for it.
Thanks! I'm gonna give this a shot tonight. -
[!--quoteo(post=368698:date=Apr 26 2006, 03:04 AM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Apr 26 2006, 03:04 AM) [snapback]368698[/snapback][/div][div class=\'quotemain\'][!--quotec--]
so ALL diagonlas?
-ie any diagonal starting from an element on the outside of the matrix?
from top left to bottom right? or in all directions?
[/quote]
all directions.
basically, items need to be placed into the matrix... however no more than two can be in any diagonal line same with horizontal and vertical.
ie. this example has a diagonal with 3
0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
*EDIT* i realise that example is quite hard to see, but you should get the idea :) -
Cool! thats really good! thanks
However, am i right in thinking thats the diagonals from the opposite corners.
I also need to check the other diagonals in the array - they are whats getting me stuck the most!
Any further suggestions?
thats a cool start! thanks
Dougal -
[!--fonto:Verdana--][span style=\"font-family:Verdana\"][!--/fonto--]
Hi,
[b]First[/b] post! :)
I am having a problem with my PHP.
I am trying to make a [b]8x8[/b] grid, with boolean values that i can then check and count how many true values are in each column, row and diagonal.
At the moment i have managed to get the grid/matrix successfully and also i have managed to check the rows and columns. So thats all cool.
However i am having trouble working out the best way to check the diagonals.
I have noticed that there is a bit of a patern with them, for example some of them as you follow it through either the x or the y value is going down and the other is going up.
I just dont know how best to put this into code.
Any suggestions would be greatly appreciated!
Thanks
Dougal[!--fontc--][/span][!--/fontc--]
file copying + CHMOD settings
in PHP Coding Help
Posted
I thought it would work with 775?
Is this a security issue?
Basically ive got a folder that i'm constantly going to be moving files in and out of - its like a store.