<?php
$servername = "localhost";
$username = "root";
$password = "admin";
$dbname = "sbsuite";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * from sys_frm WHERE ParamType='Title';";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo $row["Data"] . "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?
这是给我两个结果的代码..
我想将它们作为链接插入另一个带有图像的php页面,取决于我们点击它去另一个php页面...
感谢您的帮助!
答案 0 :(得分:1)
这是一个简单的HTML。将client/server
php和jpg替换为您想要的内容。
<a href="client.php"><img src="client.jpg" alt="Client" /></a><br />
<a href="server.php"><img src="server.jpg" alt="Server" /></a>
使用PHP
<?php
while ($row = $result->fetch_assoc()) {
?>
<a href="<?php echo $row["Data"]; ?>.php"><img src="<?php echo $row["Data"]; ?>.jpg" alt="<?php echo $row["Data"]; ?>" /></a><br />
<?php
}