The double quotes are causing trouble since everything betwen the opening and the closing double quote is a string (array elements do not get parsed correctly and also no concatenation takes place). You can do it the way gavinflud suggested. On the other hand if you wish to use double quotes you have to enclose $row elements in curly braces to get them parsed correctly:
$dirPath = "{$row['field1']}-{$row['field2']}-info";
broj1
Nearly a Posting Virtuoso
1,210 posts since Jan 2011
Reputation Points: 167
Solved Threads: 163
Skill Endorsements: 13
mysql_query returns a resource on success or false on error. It seems that it returned false so an error must have happened when issuing a query. The error should be caught by the second part of the statement: or die(mysql_error(), but for soem reason it does not. You can add this code just after the line 5 to check for the error:
if(!result) {die( mysql_error()); }
which is essentialy what the or part should do.
broj1
Nearly a Posting Virtuoso
1,210 posts since Jan 2011
Reputation Points: 167
Solved Threads: 163
Skill Endorsements: 13
In your code above the closing curly brace (belonging to the while loop) is missing.
Anyway, you can test it in such a way that instead of creating folders just echo the commands
while($row = mysql_fetch_array($result))
{
echo "{$row['field1']}-{$row['field2']}-info<br />";
}
and check (or post) the output.
broj1
Nearly a Posting Virtuoso
1,210 posts since Jan 2011
Reputation Points: 167
Solved Threads: 163
Skill Endorsements: 13
Maybe there are characters in the directory names that are not allowed. Have you checked that? You can also post the output of the following select statement (the first 10 records):
'SELECT field1, field2 FROM Table LIMIT 10;
broj1
Nearly a Posting Virtuoso
1,210 posts since Jan 2011
Reputation Points: 167
Solved Threads: 163
Skill Endorsements: 13