本文介绍了我一直收到这个错误:警告:mysqli_query()期望参数1为mysqli,null为C:\ wamp64 \ www。\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究这个问题,我无法弄清楚如何让它发挥作用!我一直得到同样的错误。作为参考,我正在尝试生成动态链接,所以当我点击列表页面上的按钮时,它会在第二页上生成内容。



如果你想要请参阅列表页面代码,让我知道。这是动态页面:



我尝试过:



I have been working on this for a while and I just can't figure out how to make it work! I keep getting the same error. For reference, I am trying to generate a dynamic link so when I click on a button from my list page it generates content on a second page.

If you want to see the list page code, let me know. Here is the dynamic page:

What I have tried:

<?php
if(isset($_GET['id'])) {
require_once  'login1.php';

$id=null;
$dbc = null;

$conn = new mysqli($hn, $un, $pw, $db); //these three lines connect to the db with the login file
if($conn->connect_error) die($conn->connect_error); //all the lines above here will be in all your codes

	$sql = "SELECT * FROM freshwater WHERE id='$id' ";
	$result = mysqli_query($dbc, $sql) or die("Bad Query: $sql");
	$row = mysqli_fetch_array($result);
	
}	
?>
<html>
<head>
<title>Fish R Us - Saltwater Fish</title>

</head>
<body>
<div class="toptext"><center>
<img src="banner.png" height="300"></img></center>
</div>
<center>
<h2><?php echo $row['name'] ?></h2>
width="150" height="150"
<img src="<?php echo $row['picture'] ?>" width="150" height="150"></img>
<table>
  <tr>
    <th>Name</th>
    <th>Type</th>
    <th>Quantity</th>
	<th>Price</th>
  </tr>
  <tr>
    <td><?php echo $row['name'] ?></td>
    <td><?php echo $row['type'] ?></td>
    <td><?php echo $row['qty'] ?></td>
	<td><?php echo $row['price'] ?></td>
  </tr>
</table><br>
<table class="fish-text">
<th><?php echo $row['description'] ?></th>
</center></table><br>
<button padding: 10px 24px;><a href="products.php">Return to Products List</a></button></body>
<button padding: 10px 24px;><a href="menu.php">Return to Menu</a></button>
</html>

推荐答案




这篇关于我一直收到这个错误:警告:mysqli_query()期望参数1为mysqli,null为C:\ wamp64 \ www。\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 08:43