我有一个表,其中包含从数据库中提取信息的数组,我已将修复链接为超链接“单击我进行修复”我已输入链接以将变量发送到将使用 $GET 来回显信息的 php。
下面的代码,我是 php 新手,一直在绞尽脑汁。我得到的唯一输出是 Welcome 。(欢迎测试信息是否通过)
<div id=list>
<?php
// Create connection
$con=mysqli_connect('172.16.254.111',"user","password","Faults"); //(connection location , username to sql, password to sql, name of db)
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//where statement in the sql syntax will select where in db to get infor, use AND to add another condition
$result = mysqli_query($con,"SELECT * FROM Fixes WHERE Product='Serv1U' AND Fault_type='Broadcast Manager'"); //this creates a variable that selects the database
//below is the echo statment to create the results in a table format, list collumn titles
echo "<table id=tables border='1'>
<tr>
<th>Products</th>
<th>Fault_type</th>
<th>Fault_Description</th>
<th>Fix</th>
</tr>";
//below is script to list reults in a table format, $row [row name on table]
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Product'] . "</td>";
echo "<td>" . $row['Fault_type'] . "</td>";
echo "<td>" . $row['Fault_Description'] . "</td>";
echo "<td><a href=\"idfix.php?Fix=" . $rows['Fix'] . "\">Click for Fix</a></td>"; //this is how you link into an echo, alsothe id=" hopefully means i can send ID information.
}
echo "</tr>";
echo "</table>";
// below closes the coonection to mysql
mysqli_close($con);
索引.php:
Welcome <?php echo $_GET["Fix"]; ?>.
我迷路了。任何帮助表示赞赏。
谢谢?>