如何结合到php';s(sql)

如何结合到php';s(sql),php,mysql,sql,Php,Mysql,Sql,我需要结合这两个代码,更可能是sql。我坐在上面大约几个小时了,弄不到它 <?php $mysqli2 = new mysqli("Edudb", "mct", "QwSkepticx97!"); $mysqli2->select_db("maturita"); $ask2 = $mysqli2->query("SELECT * FROM gallery"); if(mysqli_num_rows($ask2)>0) { while ($row2=mysqli_fe

我需要结合这两个代码,更可能是sql。我坐在上面大约几个小时了,弄不到它

<?php
$mysqli2 = new mysqli("Edudb", "mct", "QwSkepticx97!");
$mysqli2->select_db("maturita");
$ask2 = $mysqli2->query("SELECT * FROM gallery");
if(mysqli_num_rows($ask2)>0)
{   
while ($row2=mysqli_fetch_object($ask2)) 
{   
echo "<a href='show-gall.php?gallery=$row2->gall_id'>$row2->name<br></a</span>";
}
}       
?>

如果有任何建议,我将不胜感激

试试这个

include('here put the name of one file of two ');
然后把这句话放到另一句话里。
现在,另一个包含include()语句的文件显示了第二个文件中的所有内容

你的问题是,在什么意义上结合?预期的结果是什么?问题是什么?你有什么问题?重用数据库连接,无需声明两次,并运行两个单独的查询。有什么问题吗?第一个sql进入第二个代码…你不是已经这样做了吗?
include('here put the name of one file of two ');