<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
include 'conn.php';
// Attempt select query execution
$db_select = mysqli_select_db($conn,'college');
if (!$db_select) {
die("Database selection failed:: " . mysql_error($conn));
}else{
} //You don't need a ; like you do in SQL
$result = mysqli_query($conn,"SELECT * FROM college") or die("error".mysqli_error($conn));
echo "<table>"; // start a table tag in the HTML
$result = array();
while($row = mysqli_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr><td>" . $row['city'] . "</td><td>" . $row['clients'] . "</td></tr>"; //$row['index'] the index here is a field name
}
echo "</table>"; //Close the table in HTML
mysqli_close($conn);
?>
我在查询statemenet中遇到表大学确实存在的错误。我在phpmyadmin中创建了table college并用假值填充它,但我仍然遇到查询错误。错误在第14行。