Re: part two same issue - unwanted empty values in array [message #185744 is a reply to message #185741] |
Mon, 05 May 2014 16:38 |
Mr Oldies
Messages: 241 Registered: October 2013
Karma:
|
Senior Member |
|
|
On Mon, 05 May 2014 11:36:25 -0400, Jerry Stuckle wrote:
> On 5/5/2014 11:04 AM, richard wrote:
>> http://mroldies.net/radio/24hours3.php
>>
>> As you will see, at the bottom of the list I am left with the equal number
>> of unassigned array values that now contain nothing.
>> I don't even want that in the list.
>> How do I eliminate them altogether?
>>
>
> Once again you didn't show your code, so it's impossible to tell.
>
> You also have an invalid argument for foreach()...
>
> With all of that, why aren't you using a database? You're going through
> a whole lot of unnecessary work that the database can do for you.
Just how does one use a database to play music with?
"Data" means information. It is not the file itself.
The array I am creating is a prelude to using the database.
Ergo, the crazy numbering scheme for the file names.
Each file name will correspond to the songID in the database.
That in turn, fetches the required information I want to display.
e.g. Track title, artist, year and rank.
Whereas I could just as easily use the basic information for file names, I
have found out that only ivites spiders and crawlers to take advantage and
identify who has that song.
I have checked my stats for links and found one guy who was directly
linking onto his site so his visitors could freely download.
I pointe out to him that was not only illegal, but as I had to pay a fee to
legally broadcast, I could sue him if it came to that.
As could BMI and ASCAP sue him.
He got the message and no longer links.
Since bots don't know what the numbers mean, it is useless information to
them.
As for the code, here is what I have so far.
$hi=0;
for ($i = 59; $i <= 69; $i++) {
$yr="19$i";
$dir='../audio/'.$yr.'/';
$files = scandir($dir);
$number=count($files);
sort($files);
$hi=$hi+$number;
foreach ($files as $file)
if ($file !=="." && $file !=="..")
$master[] = $file;
}
echo $hi;
echo "<br>";
sort($master);
for ($x=0;$x<=$hi;$x++){echo $x.")..".$master[$x]."<br>";}
|
|
|