klotzdr Posted November 25, 2012 Share Posted November 25, 2012 I have a SQL query that pulls information from a coins DB, the title is converted into a hyperlink, the link works, but I need it to open in a new browser window. Here is the PHP code: <?php $dbc = mysql_connect('homesaleacrescom.ipagemysql.com', 'xxxxxxx', 'xxxxx'); if (!$dbc) { die('Could not connect: ' . mysql_error()); } mysql_select_db('coins', $dbc); $query = ("SELECT * FROM listings" ); $result = mysql_query($query); echo "<table width='100%' border='0'> <tr> </tr>"; while($row = mysql_fetch_array($result)){ $link=$rows["url"]; echo "<tr>"; echo "<td>" ."<a href='". $row['url'] ."' >". $row['title'] . "</a>". "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "</tr>"; } echo "</table>"; if (!mysql_query($query,$dbc)) { die('Error: ' . mysql_error()); } mysql_close($dbc); ?> Right now i have all the links set up just to point to yahoo.com as this is just test data, but need to links to open up a new browser window. Here is the actual address to the site to see what I am talking about: http://silverhalves.com/indextest.php Quote Link to comment https://forums.phpfreaks.com/topic/271130-need-to-make-sql-query-into-hyperlink-that-opens-new-window/ Share on other sites More sharing options...
Pikachu2000 Posted November 25, 2012 Share Posted November 25, 2012 Regarding new windows, and the difference between target="_blank" and target="_new": http://www.searchenginejournal.com/when-not-to-use-target_blank-link-attribute/19924/ You might want to consider a modal box instead of actually opening a new browser window. A lot of people really hate having new windows open unless they specifically want it to happen that way. Quote Link to comment https://forums.phpfreaks.com/topic/271130-need-to-make-sql-query-into-hyperlink-that-opens-new-window/#findComment-1394900 Share on other sites More sharing options...
DavidAM Posted November 25, 2012 Share Posted November 25, 2012 ... (what Pikachu said, and) most browsers today make it very simple to open a link in a new window (or tab) if that is what the user wants. Quote Link to comment https://forums.phpfreaks.com/topic/271130-need-to-make-sql-query-into-hyperlink-that-opens-new-window/#findComment-1394901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.