我找到了如何通过单击在新标签页中打开几页的答案,但我不知道如何使用fetch从mysqli数据库中放置网址。
mysqli声明是......
$pick_site = $mysqli->prepare("SELECT url FROM sites where chosen = ? ORDER BY name ASC");
$pick_site->bind_param('s', $yesterday);
$pick_site->execute();
$pick_site->store_result();
$pick_site->bind_result($list_sites);
while ($pick_site->fetch_array()) {
$mysites = $list_sites;
}
这里有用于打开标签的javascript代码
<a id="test" href="#"> CLick </a>
<script type="text/javascript">
document.getElementById("test").onclick = function(){
window.open("http://www.google.com",'_blank');
window.open("http://www.p3php.in",'_blank');
}
</script>
非常感谢, 伊凡。
答案 0 :(得分:1)
只需回显这样的链接:
<a id="test" href="#"> CLick </a>
<script type="text/javascript">
document.getElementById("test").onclick = function(){
<?php while ($pick_site->fetch_array()) { ?>
window.open("<?= $link ?>",'_blank');
<?php } ?>
}
</script>