由于某种原因,“描述”项返回。NULL使用以下代码:<?php
include('db.php');$result = mysql_query('SELECT * FROM `staff` ORDER BY `id` DESC LIMIT 2')
or die(mysql_error());$rows = array();while($row = mysql_fetch_assoc($result)){
$rows[] = $row;}echo json_encode($rows);?>下面是我的数据库的模式:CREATE TABLE `staff` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` longtext COLLATE utf8_unicode_ci,
`description` longtext COLLATE utf8_unicode_ci,
`icon` longtext COLLATE utf8_unicode_ci,
`date` longtext COLLATE utf8_unicode_ci,
`company` longtext COLLATE utf8_unicode_ci,
`companyurl` longtext COLLATE utf8_unicode_ci,
`appurl` longtext COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci下面是在页面上呼应的内容:[{"id":"4","name":"Noter 2","description":null,"icon":
"http:\/\/images.apple.com\/webapps\/productivity\/images\/noter2_20091223182720-thumb.jpg","date":
"1262032317","company":"dBelement, LLC","companyurl":"http:\/\/dbelement.com\/","appurl":
"http:\/\/noter2.dbelement.com"},{"id":"3","name":"Noter 2","description":null,"icon":
"http:\/\/images.apple.com\/webapps\/productivity\/images\/noter2_20091223182720-thumb.jpg"
,"date":"1262032317","company":"dBelement, LLC","companyurl":"http:\/\/dbelement.com\/","appurl":"http:\/\/noter2.dbelement.com"}]有什么想法吗?
3 回答
心有法竹
TA贡献1866条经验 获得超5个赞
0 = JSON_ERROR_NONE1 = JSON_ERROR_DEPTH2 = JSON_ERROR_STATE_MISMATCH3 = JSON_ERROR_CTRL_CHAR4 = JSON_ERROR_SYNTAX5 = JSON_ERROR_UTF8
MMMHUHU
TA贡献1834条经验 获得超8个赞
echo json_encode($rows);echo json_last_error(); // returns 5 ?
- 3 回答
- 0 关注
- 369 浏览
添加回答
举报
0/150
提交
取消