我已经连接到数据库,并试图检索我在表单中捕获的数据。我知道我错过了一个结束语句,但添加它会给出错误。我的代码有什么问题?当试图从数据库显示数据时没有数据
解析错误:语法错误,以.php意外T_ENDWHILE上线29
<?php
include "connect.php";
error_reporting(E_ERROR);
$Link = mysqli_connect($Host, $User, $Password, $Database);
$Query = "SELECT * FROM {$Table_2}";
if($Result = mysqli_query($Link, $Query)){
while($row = mysqli_fetch_array($Result)){
$tcgname = $row['name'];
$tcgintelligence = $row['intelligence'];
$tcgstrength = $row['strength'];
$tcgspeed = $row['speed'];
$tcgenergy = $row['energy'];
$tcgfighting = $row['fighting'];
$tcggoogle = $row['google'];
$tcgbiography = $row['biography'];
echo $tcgname;
echo $tcgbiography;
echo $tcgintelligence;
echo $tcgstrength;
echo $tcgspeed;
echo $tcgenergy;
echo $tcgfighting;
echo $tcggoogle;
endwhile;
}
}
?>
</body>
</html>
endwhile?不知道为什么它应该丢失......你也许应该在问这里之前了解更多关于PHP的知识;-) – bwoebi
错误是什么? – hamobi
你缺少'mysqli_select_db()'怎么办?也许还可以在你的mysqli_xxx函数中添加一些'或die()'函数 – roycable