我有這段代碼在我的網站上顯示兩個記錄在一個表中。它目前沒有工作。PHP mysqli代碼不工作
<?php
//make connection
mysqli_connect('localhost', 'root', 'password', 'databasename')or die('Connection could not be established With msql_connect');
$sql = "SELECT * FROM players ORDER BY bankacc DESC LIMIT 10";
$records = mysqli_query($sql) or die('Connection could not be established With mysqli_query');
?>
要創建我有這樣的PHP代碼表:
<?php
while($players=mysqli_fetch_assoc ($records)){
echo"<tr>";
echo"<td>","<center>".$players['name'];"</center>";"<td>";
echo "<td>","<center>","$",number_format($players['bankacc']);"</center>";"<td>";
echo"</tr>";
}//end while
?>
當我嘗試運行它,它說:
Connection could not be established with mysqli_query on my webpage I hope someone can help me.
你能夠在命令行連接到數據庫? – Lewis42