I have this problem, I want to use opendir
with this array of directories, it is possible? with a fixed url I can read files with readdir
. But I dont know what to do with multiple directories...
Creating the array:
$results = mysqli_query($connecDB,"SELECT * FROM brands WHERE 1 IN (php, ruby, java) ORDER BY id ASC");
//select all records with value "1" in different columns "php ruby java".
// The value "1" indicates a folder created named $id in php, ruby and/or java folder
$resultsArray = array();
while($row = mysqli_fetch_assoc($results)){
if($row['php'] == 1) {
$resultsArray['php'][] = $row['id'];
}
if($row['java'] == 1) {
$resultsArray['java'][] = $row['id'];
}
if($row['ruby'] == 1) {
$resultsArray['ruby'][] = $row['id'];
}
}
foreach($resultsArray as $language => $array){
echo "url/" . $language . "/" . $row['id'] . "<br>";
}
And the output example:
url/php/1/
url/java/1/
url/php/2/
url/ruby/2/
url/java/2/
url/php/3/
url/php/4/
url/ruby/4/
etc
thank you very much