• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 665
  • Last Modified:

Call to undefined function: array()

I keep getting this error: Call to undefined function: array() on line 17

Here is my code, and I have star'ed line 17.  I have no clue why it tells me this...

<BODY onLoad="setInterval('opennext()',10000)">
<?php
     $sites=file("sites.txt");
     if(count($sites)==0){
          echo "Sorry!  There was an error loading sites.txt";
     }
?>


<script language=javascript>
popups=new Array()
<?php
$ads=count($sites);
for($x=0;$x<$ads;$x++){

*******echo "popups" . chr(91) . $x . chr(93) . "=" . chr(34) .$sites(x) . chr(34);*******  <---Line 17

}
?>
current=0

function opennext(){
myVar=window.open(popups[current])
if (current<popups.length){
current++
}
else{
current=0
}
}
0
bomax
Asked:
bomax
  • 2
  • 2
1 Solution
 
bobsledbobCommented:

I think you're probably looking to use $sites[x] (with brackets) not $sites(x) (with paranthesis), right?


*******echo "popups" . chr(91) . $x . chr(93) . "=" . chr(34) .$sites[x] . chr(34);*******  <---Line 17

0
 
bomaxAuthor Commented:
Thanks, that did it.  Somehow I missed it!

But now I get an error on line 6:

echo "Sorry!  There was an error loading sites.txt";

Error is: Expected ';'

Any ideas?

-Matt
0
 
bobsledbobCommented:

hmm, no idea.  I copied that block of code and it ran just fine for me.

0
 
bomaxAuthor Commented:
Anyone else know what might be causing my new error? Because I am definitely getting one and it does not work.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now