FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » part two same issue - unwanted empty values in array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: part two same issue - unwanted empty values in array [message #185745 is a reply to message #185744] Mon, 05 May 2014 16:51 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 5/5/2014 12:38 PM, richard wrote:
> 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.
>

A file is nothing more than data. And a file system is nothing more
than a (non-SQL) database.

> 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.

Putting music in the database means you need to serve the files with a
PHP script - but it also allows you to run some tests to see if someone
hotlinked to your files (i.e. "HTTP_REFER" is not a perfect test, but
works with most browsers).

> 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>";}
>

Except $master does not have all of the entries that $files had, since
you didn't copy the "." and ".." files over.



--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to join two arrays?
Next Topic: The goto statement in PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 03:46:57 GMT 2024

Total time taken to generate the page: 0.04442 seconds