我已經連接到數據庫,並試圖檢索我在表單中捕獲的數據。我知道我錯過了一個結束語句,但添加它會給出錯誤。我的代碼有什麼問題?當試圖從數據庫顯示數據時沒有數據
解析錯誤:語法錯誤,以.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