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

array problem

coolv
P: 6
Hello Everyone

this is my code

$snoopy = new Snoopy();
$links=$_SESSION['links']; //Array of links

for(int $i=0;$i<count($links);$i++)
{
$snoopy->fetchlinks($link);
$links1=$snoopy->results;
$_SESSION['links1']=$links1;
echo '<script language="javascript">document.location="'.basenam e ($_SERVER['PHP_SELF']).'";</script>'; //Reload the page
}

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+
1 Reply


code green
Expert 100+
P: 1,726
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.
You need to keep a tally in the script but outside the loop $val++; and pass the current value of val via a URL variable.
Place this after [PHP]$_SERVER['PHP_SELF'].'?val='.$val;[/PHP] There are more sophisticated ways ie SESSION variables.
Jan 11 '08 #2

Post your reply

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