php json_encode输出限制?

时间:2016-09-06 20:11:48

标签: php mysql json mysqli

这是我从表

输出一行的代码
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服务器,仅供参考。

0 个答案:

没有答案