我在ampps中使用的这段代码有效,但是当我改为xampp时,它给了我一个我不知道的错误。 我的php是:
<?php
include_once 'dbconfig.php';
$sql_query="SELECT * FROM users";
$result_set=mysqli_query($link, $sql_query);
?>
<table border="1">
<tr>
<td><strong>descricao</strong></td>
<td><strong>Tipo</strong></td>
<td><strong>cenario</strong></td>
</tr>
<?
while($row = mysqli_fetch_array($result_set)){
?>
<tr>
<td><?=$row['descricao']?></td>
<td><?=$row['Tipo_Divisao']?></td>
<td><?=$row['cenario']?></td>
</tr>
<?
}
?>
</table>
错误是这样的:
Undefined variable: row in C:\xampp\htdocs\domotica\select.php on line 17,18,19
包含文件是:
<?php
$host = "localhost";
$user="root";
$password="";
$datbase="domotica";
$link = mysqli_connect($host, $user, $password);
mysqli_select_db($link, $datbase);
?>