Question: I want to open a new window for each $url created how could I do that?

```
<?php
require_once('sql.php');

$result = mysql_query("SELECT * FROM gamertags ORDER BY id DESC LIMIT 10");

while($row = mysql_fetch_array($result)){
    // Prepare gamertag for url
    $gamertag = strtolower($row['gamertag']);
    $url = "http://halogamertags.com/tags/index.php?player_name=".urlencode($gamertag);
}
?>

```

Answer: 
**Warning ~ Will attempt to open 10 windows on load:**

**[Live Demo](http://jsfiddle.net/zhehg/)** 

```
$("#gamertags a").each(function() {
    window.open($(this).attr('href'), 'Player Details', 'width=500,height=500');
});

```
In your generated HTML, use `target="_blank"` to cause a new new window to be launched when the link is clicked.

```
<a href="url" target="_blank">Link</a>

```

You can't do it in PHP since it's a server since it's server side. You might also do it from JavaScript but more information would be useful.

In JavaScript, you can use the [`window.open()`](http://www.w3schools.com/jsref/met_win_open.asp) method