这是我从表
输出一行的代码if (empty($_GET['artist']))
exit;
$q = $_GET["artist"];
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT artistName FROM artists WHERE (artistName LIKE '".$q."%')";
$sth = mysqli_query($conn, $sql);
$json = mysqli_fetch_all ($sth, MYSQLI_ASSOC);
echo json_encode($json);
$conn->close();
现在,如果我这样做,该表包含各种大小的列
$sql = "SELECT * FROM artists WHERE (artistName LIKE '".$q."%')";
Chrome中的网络检查说failed to load response data
但如果我这样做
$sql = "SELECT artistName, ... FROM artists WHERE (artistName LIKE '".$q."%')";
输出数据就好了。
请告诉我我做错了什么。
我正在研究Apache服务器,仅供参考。