By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

array problem

P: 56
Hello Everyone

this is my code
Expand|Select|Wrap|Line Numbers
  1. $snoopy = new Snoopy();
  2. $links=$_SESSION['links']; //Array of links
  4. for(int $i=0;$i<count($links);$i++)
  5. {
  6. $snoopy->fetchlinks($link);
  7. $links1=$snoopy->results;
  8. $_SESSION['links1']=$links1;
  9. echo '<script language="javascript">document.location="'.basename ($_SERVER['PHP_SELF']).'";</script>'; //Reload the page
  10. }
Here $link is array of links. first time for loop is executed it takes first link for bellow code.after that page is reloaded. here i want after page reload for loop is start with incaremented value of i.

also i want to know how to access array values in for loop after or befor pageload.

Can anyone has solution for this.

thanks in advance
Jan 9 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,639
Er, some questions...

what does the snoopy class do?
why do you use a loop at all (I don't see the use of the counter variable, alas you print the reload statement several times)?
before the page can reload, all php code is execute, i.e. your loop is completely finished (php - server, javascript (does the reload) - client)
Aug 22 '08 #2

Expert 100+
P: 1,584
Please use CODE tags when posting source code:

[code= PHP ]
Your PHP code goes here
[ /CODE]
Aug 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.