Sorry, I was very tired... The answer is that DirectoryIterat or iterates through the directory contents. So when i ask if the current element in DirectoryIterat or is a directory, except when the directory iterator is pointing at the . and .. directories, the answer will allways be no!
The right way to do this is to call is_dir($path)
sorry for stupid post
User Profile
Collapse
-
Weird DirectoryIterator behaviour
Hello,
can someone make light on this please :
i have a path to a dir:
Code:$path = "/var/www/Tests"; echo $path;
Code:/var/www/Tests
Code:$dirIt = new DirectoryIterator($path);
Code:if (!$dirIt->isDir()) { echo "This is not
-
I'm not sure, but i think you should better use your sanitized $myusername variable rather than the $_POST['anything'];
I don't know how that could be exploited but, i mean, if you already sanitized your variable, better use it...Leave a comment:
-
are you sure there are no spaces at the beginning of your script, or anything that would be sent before the header(location ...) is called?
cookies are sent along with headers, so make sure they are set before headers are sent. And make sure headers are not sent before you think they are... :)
let me knowLeave a comment:
-
thanks for replying dlite922,
as you point out, it would not make sense to share attributes (class variables) between objects, because they need to be able to be different from each other.
Static attributes are shared between all objects, that's why they are sometimes called class attributes, rather than instance/object attributes.
But as you may have notice, methods do not change between objects. Let's say...Leave a comment:
-
Do parent class share memory with extended classes?
Hello,
I was wondering the cost of creating an instance of an extended class.
By that I mean, if I have classes:
- A
- A1 and A2,
where: A1 and A2 extend class A.
what do instances A1 and A2 share of their common parent A in memory?
a) Nothing
b) Attributes
c) just Methods
d) Attributes and Methods
by that I would like to know what has to be put...Last edited by guillermobytes; Jan 24 '11, 12:17 AM. Reason: please edit title to : do same parent class share memory -
Well i finally found the solution
Code:SELECT mx.maxAge AS maxAge, cc.childrenCount AS childrenCount, i.localUrl AS imageLocalUrl, p.name AS parentName FROM (SELECT parentId, MAX(age) AS maxAge FROM Children GROUP BY parentId) AS mx INNER JOIN (SELECT parentId, COUNT(*) AS childrenCount FROM children GROUP BY parentId) AS cc ON (mx.parentId = cc.parentId)
Leave a comment:
-
what i can't figure out how to do, is to get the correct child id, so far what i can get is the correct max age and the parent name.Leave a comment:
-
You are right rabbit, it doesn't work!! :S
So if any one has a hint I'm still interested!Leave a comment:
-
what is the output of the query :Code:select * from Point_item_master where PointName='ABC'
how is the date formatted?
try copying the date result form the query i show you, then take the date column name and try creating a new query with the date column name and date result in the where clause and see what happens.Leave a comment:
-
Ok so i finally wrapped my head around it!
The query would be :
Code:SELECT p.name AS parentName, cp.imgUrl AS imgUrl, [B]MAX(c.age)[/B] AS age FROM parent AS p RIGHT JOIN children AS c ON (p.parentId = c.parentId) RIGHT JOIN childrenPictures AS cp ON (c.pictureId = cp.pictureId)) [B]GROUP BY p.name[/B]
Every child that...Leave a comment:
-
-
hi,
how do you store your dates in mysql : as a string or as a date?
what does it return if you make the same query without date in the where clause?Leave a comment:
-
foreach parent return eldest son's picture
hello i have 3 tables : parent, children, childrenPicture s
Table parent
parentId | name
Table children
childId | parentId | pictureId | age
Table childrenPicture s
pictureId | imgUrl
no i would like to return all parent names with their eldest son's picture (only return parents that have children, and only consider children that have pictures)
so i thought of... -
thanks Dormilich for your help, but still...
Code:is_writable() // false
I'll try to fix the filesystem corruption and then run it again.
regardsLeave a comment:
-
Why is directory with permissions 777 not writable?
hi there,
i'm having a problem with a directory under unix (Mac OS X).
I would like to useCode:file_put_contents($dir, file_get_contents(...));
ok, so what i did is to chmod 777 $dir.
so now file permissions are :
Code:ls -l /Users/gui/Desktop/images
Code:drwxrwxrwx 2 gui staff 68 Nov 20 01:23 images
-
reset array pointer weird behavior
Hi everyone,
I need some help here with a situation where I have an array and a call to reset() or even when assigning that array to another variable the internal pointer does not point to the first element!!!
I don't know how to debug this..
the array is an object attribute and it is set from a preg_match_all( ) call.
i'm sure there are elements in the array... I don't understand :(
... -
I don't understand what you mean when you say : "- how to implement (on the PHP side)? if you return a variable, it could have any type, and not every type can be converted into any other type. (it might not be a huge problem with String, but with object/interface)"
why should you convert to another type than the one returned? the purpose of restricting the return type, is to make the script crash when the return type is not the one...Leave a comment:
-
yes good point,
however if I find loose types very useful when you declare variables, with functions I don't. It is very helpful to be able to force some type of return in interfaces/abstract classes... this allows to create frameworks where the end developer directly knows what he can do and what he cannot.
It also reduces the amount of code, because there is no need to make type checks for each method of some interface implementation,...Leave a comment:
-
thanks a lot markus!
well I don't know if this will be very expensive in efficiency, but for coding, I find it easier to explicitly tell in an interface what a method should return, than in documentation or even in the piece of code (where the method is supposed to be called).
Anyways I'm not an advanced programmer but that's how i feel about it.Leave a comment:
No activity results to display
Show More
Leave a comment: