0

Suppose I have a php loop as follows:

while($row = mysql_fetch_array($result)){    
  $phones = $row['phone'];
  $text   = $row['message']; 
  $url = 'http://abcwebsite.com/user.php? '&mobileno=' . $phones . '&message=' . $text;
}

Is that how to run the url inside the loop until the loop is completed?

2
  • 1
    What do you mean, run the url? Try file_get_contents($url); ? Commented Nov 6, 2015 at 12:00
  • Do you know that your code will not work in PHP 7 (future version of PHP) and that mysql_* functions are deprecated since a long time ? Commented Nov 6, 2015 at 15:21

2 Answers 2

1

You can use array to collect all Urls:

like : $urls=array();

Can use $url inside Loop.

Sign up to request clarification or add additional context in comments.

Comments

1
    $i = 0;
    $url = array();
      while($row = mysql_fetch_array($result)){    
            $phones = $row['phone'];
            $text   = $row['message']; 
            $url[$i] = 'http://abcwebsite.com/user.php? '&mobileno=' . $phones . '&message=' . $text;
            $i++;
    }

And after that you can use array $url, which contain all urls.

1 Comment

but how to execute the url..i used header() function but it works only if there is only one row fetched.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.