我有一个查询,在 MySQL 中执行时返回 18 条记录,但是当我运行 php 代码时,它返回一个空数组:
PHP代码:
$db = &JFactory::getDbo();
$db->setQuery($query);
$list = $db->loadObjectList();
die (var_dump($list));
查询 var_dump:
string(1215) " SELECT i.title AS title, i.metadesc, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, CONCAT(i.introtext, i.fulltext) AS text, CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug FROM #__catalog_items AS i INNER JOIN #__catalog_categories AS c ON c.id=i.catid AND c.access IN(1,1) WHERE (MATCH(i.title, i.introtext, i.`fulltext`,i.extra_fields_search,i.image_caption,i.image_credits,i.video_caption,i.video_credits,i.metadesc,i.metakey) AGAINST ('+מלך* +היער*' IN BOOLEAN MODE) ) AND i.trash = 0 AND i.published = 1 AND i.access IN(1,1) AND c.published = 1 AND c.access IN(1,1) AND c.trash = 0 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2012-11-21 16:20:36' ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2012-11-21 16:20:36' ) AND c.language IN ('he-IL', '*') AND i.language IN ('he-IL', '*') GROUP BY i.id ORDER BY i.created DESC"
奇怪的代码'+מלך* +היער*'是由于该站点是希伯来语的,我不知道它是否有什么事情要做,因为正如我所解释的,在执行查询时通过 phpmyadmin 它按预期工作。
任何的想法?
编辑
$db var_dump:
object(JFalangDatabase)#155 (26) {
["_mlTableList"]=> array(14) {
[0]=>
string(18) "catalog_categories"
[1]=>
string(13) "catalog_items"
[2]=>
string(10) "categories"
[3]=>
string(15) "contact_details"
[4]=>
string(7) "content"
[5]=>
string(13) "faq_questions"
[6]=>
string(4) "menu"
[7]=>
string(7) "modules"
[8]=>
string(18) "recipes_categories"
[9]=>
string(20) "recipes_extra_fields"
[10]=>
string(13) "recipes_items"
[11]=>
string(20) "recipes_servingtypes"
[12]=>
string(12) "recipes_tags"
[13]=>
string(13) "recipes_units"
}
["_refTables"]=>
array(6) {
["fieldTablePairs"]=>
array(2) {
[0]=>
string(13) "catalog_items"
[1]=>
string(18) "catalog_categories"
}
["tableAliases"]=>
array(2) {
["catalog_items"]=>
string(1) "i"
["catalog_categories"]=>
string(1) "c"
}
["reverseTableAliases"]=>
array(2) {
["i"]=>
string(13) "catalog_items"
["c"]=>
string(18) "catalog_categories"
}
["fieldAliases"]=>
array(10) {
["title"]=>
string(5) "title"
["metadesc"]=>
string(8) "metadesc"
["metakey"]=>
string(7) "metakey"
["section"]=>
string(4) "name"
["image_caption"]=>
string(13) "image_caption"
["image_credits"]=>
string(13) "image_credits"
["video_caption"]=>
string(13) "video_caption"
["video_credits"]=>
string(13) "video_credits"
["extra_fields_search"]=>
string(19) "extra_fields_search"
["created"]=>
string(7) "created"
}
["fieldTableAliasData"]=>
array(10) {
[0]=>
array(4) {
["fieldNameAlias"]=>
string(5) "title"
["fieldName"]=>
string(5) "title"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[1]=>
array(4) {
["fieldNameAlias"]=>
string(8) "metadesc"
["fieldName"]=>
string(8) "metadesc"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[2]=>
array(4) {
["fieldNameAlias"]=>
string(7) "metakey"
["fieldName"]=>
string(7) "metakey"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[3]=>
array(4) {
["fieldNameAlias"]=>
string(7) "section"
["fieldName"]=>
string(4) "name"
["tableNameAlias"]=>
string(1) "c"
["tableName"]=>
string(18) "catalog_categories"
}
[4]=>
array(4) {
["fieldNameAlias"]=>
string(13) "image_caption"
["fieldName"]=>
string(13) "image_caption"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[5]=>
array(4) {
["fieldNameAlias"]=>
string(13) "image_credits"
["fieldName"]=>
string(13) "image_credits"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[6]=>
array(4) {
["fieldNameAlias"]=>
string(13) "video_caption"
["fieldName"]=>
string(13) "video_caption"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[7]=>
array(4) {
["fieldNameAlias"]=>
string(13) "video_credits"
["fieldName"]=>
string(13) "video_credits"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[8]=>
array(4) {
["fieldNameAlias"]=>
string(19) "extra_fields_search"
["fieldName"]=>
string(19) "extra_fields_search"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
[9]=>
array(4) {
["fieldNameAlias"]=>
string(7) "created"
["fieldName"]=>
string(7) "created"
["tableNameAlias"]=>
string(1) "i"
["tableName"]=>
string(13) "catalog_items"
}
}
["fieldCount"]=>
int(13)
}
["_skipSetRefTables"]=>
bool(false)
["orig_limit"]=>
int(0)
["orig_offset"]=>
int(0)
["_table_prefix"]=>
string(6) "oyhkl_"
["profileData"]=>
array(2) {
["JOverrideDatabase::setRefTables"]=>
array(3) {
["total"]=>
float(0.0053415298461914)
["count"]=>
int(20)
["start"]=>
array(0) {
}
}
["JFalangDatabase::loadObjectList"]=>
array(3) {
["total"]=>
float(0.011144638061523)
["count"]=>
int(7)
["start"]=>
array(0) {
}
}
}
["name"]=>
string(6) "mysqli"
["nameQuote":protected]=>
string(1) "`"
["nullDate":protected]=>
string(19) "0000-00-00 00:00:00"
["dbMinimum":protected]=>
string(5) "5.0.4"
["_database":"JDatabase":private]=>
string(20) "jom_database"
["connection":protected]=>
object(mysqli)#156 (17) {
["affected_rows"]=>
int(0)
["client_info"]=>
string(6) "5.1.49"
["client_version"]=>
int(50149)
["connect_errno"]=>
int(0)
["connect_error"]=>
NULL
["errno"]=>
int(0)
["error"]=>
string(0) ""
["field_count"]=>
int(13)
["host_info"]=>
string(25) "Localhost via UNIX socket"
["info"]=>
NULL
["insert_id"]=>
int(0)
["server_info"]=>
string(17) "5.1.63-0+squeeze1"
["server_version"]=>
int(50163)
["sqlstate"]=>
string(5) "00000"
["protocol_version"]=>
int(10)
["thread_id"]=>
int(94278)
["warning_count"]=>
int(0)
}
["count":protected]=>
int(20)
["cursor":protected]=>
Warning: var_dump(): Couldn't fetch mysqli_result in /var/www/clients/client1/web2/web/plugins/search/catalog/catalog.php on line 198
Warning: var_dump(): Couldn't fetch mysqli_result in /var/www/clients/client1/web2/web/plugins/search/catalog/catalog.php on line 198
Warning: var_dump(): Property access is not allowed yet in /var/www/clients/client1/web2/web/plugins/search/catalog/catalog.php on line 198
Warning: var_dump(): Couldn't fetch mysqli_result in /var/www/clients/client1/web2/web/plugins/search/catalog/catalog.php on line 198
Warning: var_dump(): Property access is not allowed yet in /var/www/clients/client1/web2/web/plugins/search/catalog/catalog.php on line 198
object(mysqli_result)#317 (5) {
["current_field"]=>
NULL
["field_count"]=>
NULL
["lengths"]=>
NULL
["num_rows"]=>
NULL
["type"]=>
NULL
}
["debug":protected]=>
bool(true)
["limit":protected]=>
int(50)
["log":protected]=>
array(20) {
[0]=>
string(142) "SELECT extension_id AS id, element AS "option", params, enabled
FROM oyhkl_extensions
WHERE `type` = 'component' AND `element` = 'com_catalog'"
[1]=>
string(142) "SELECT extension_id AS id, element AS "option", params, enabled
FROM oyhkl_extensions
WHERE `type` = 'component' AND `element` = 'com_recipes'"
[2]=>
string(389) "SELECT m.id, m.menutype, m.title, m.alias, m.note, m.path AS route, m.link, m.type, m.level, m.language,m.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id,e.element as component
FROM oyhkl_menu AS m
LEFT JOIN oyhkl_extensions AS e ON m.component_id = e.extension_id
WHERE m.published = 1 AND m.parent_id > 0 AND m.client_id = 0
ORDER BY m.lft"
[3]=>
string(62) "SELECT joomlatablename,tablepkID FROM `oyhkl_falang_tableinfo`"
[4]=>
string(47) "SELECT * FROM oyhkl_languages ORDER BY ordering"
[5]=>
string(40) "SHOW FULL COLUMNS FROM `oyhkl_languages`"
[6]=>
string(141) "SELECT extension_id AS id, element AS "option", params, enabled
FROM oyhkl_extensions
WHERE `type` = 'component' AND `element` = 'com_falang'"
[7]=>
string(395) "SELECT falang_content.reference_field, falang_content.value, falang_content.reference_id, falang_content.original_value
FROM oyhkl_falang_content AS falang_content
WHERE falang_content.language_id=2
AND falang_content.published=1
AND falang_content.reference_id IN(101,102,103,104,105,167,106,164,109,110,155,156,157,158,159,160,161,162,163,169)
AND falang_content.reference_table='menu'"
[8]=>
string(141) "SELECT extension_id AS id, element AS "option", params, enabled
FROM oyhkl_extensions
WHERE `type` = 'component' AND `element` = 'com_search'"
[9]=>
string(213) "SELECT id, home, template, s.params
FROM oyhkl_template_styles as s
LEFT JOIN oyhkl_extensions as e ON e.element=s.template AND e.type='template' AND e.client_id=s.client_id
WHERE s.client_id = 0 AND e.enabled = 1"
[10]=>
string(444) "SELECT a.title, a.description AS text, "" AS created, "2" AS browsernav, a.id AS catid, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug
FROM oyhkl_categories AS a
WHERE (a.title LIKE '%מלך היער%' OR a.description LIKE '%מלך היער%') AND a.published IN (1,2) AND a.extension = 'com_content'AND a.access IN (1,1) AND a.language in ('he-IL','*')
GROUP BY a.id
ORDER BY a.title DESC LIMIT 0, 50"
[11]=>
string(1049) "SELECT a.name AS title, '' AS created, a.con_position, a.misc, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, CONCAT_WS(',', a.name, a.con_position, a.misc) AS text,CONCAT_WS(' / ', '×× ×©×™ קשר', c.title) AS section,'2' AS browsernav
FROM oyhkl_contact_details AS a
INNER JOIN oyhkl_categories AS c ON c.id = a.catid
WHERE (a.name LIKE '%מלך היער%'OR a.misc LIKE '%מלך היער%'OR a.con_position LIKE '%מלך היער%'OR a.address LIKE '%מלך היער%'OR a.suburb LIKE '%מלך היער%'OR a.state LIKE '%מלך היער%'OR a.country LIKE '%מלך היער%'OR a.postcode LIKE '%מלך היער%'OR a.telephone LIKE '%מלך היער%'OR a.fax LIKE '%מלך היער%') AND a.published IN (1,2) AND c.published=1 AND a.access IN (1,1) AND c.access IN (1,1) AND a.language in ('he-IL','*') AND c.language in ('he-IL','*')
GROUP BY a.id, a.con_position, a.misc
ORDER BY a.name DESC LIMIT 0, 50"
[12]=>
string(1178) "SELECT a.title AS title, a.metadesc, a.metakey, a.created AS created,CONCAT(a.introtext,a.fulltext) AS text,c.title AS section, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, '2' AS browsernav
FROM oyhkl_content AS a
INNER JOIN oyhkl_categories AS c ON c.id=a.catid
WHERE ((a.title LIKE '%מלך%' OR a.introtext LIKE '%מלך%' OR a.fulltext LIKE '%מלך%' OR a.metakey LIKE '%מלך%' OR a.metadesc LIKE '%מלך%') AND (a.title LIKE '%היער%' OR a.introtext LIKE '%היער%' OR a.fulltext LIKE '%היער%' OR a.metakey LIKE '%היער%' OR a.metadesc LIKE '%היער%'))AND a.state=1 AND c.published = 1 AND a.access IN (1,1) AND c.access IN (1,1) AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-11-21 17:01:20') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-11-21 17:01:20') AND a.language in ('he-IL','*') AND c.language in ('he-IL','*')
GROUP BY a.id, a.title, a.metadesc, a.metakey, a.created, a.introtext, a.fulltext, c.title, a.alias, c.alias, c.id
ORDER BY a.created DESC LIMIT 0, 50"
[13]=>
string(998) "SELECT c.*, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as slug
FROM oyhkl_categories as c
LEFT JOIN oyhkl_categories AS s ON (s.lft < c.lft AND s.rgt > c.rgt AND c.language in ('he-IL','*')) OR (s.lft >= c.lft AND s.rgt <= c.rgt)
LEFT JOIN (SELECT cat.id as id FROM oyhkl_categories AS cat JOIN oyhkl_categories AS parent ON cat.lft BETWEEN parent.lft AND parent.rgt WHERE parent.extension = 'com_content' AND parent.published != 1 GROUP BY cat.id) AS badcats ON badcats.id = c.id
WHERE (c.extension='com_content' OR c.extension='system') AND c.access IN (1,1) AND c.published = 1 AND s.id=8 AND badcats.id is null
GROUP BY c.id, c.asset_id, c.access, c.alias, c.checked_out, c.checked_out_time,
c.created_time, c.created_user_id, c.description, c.extension, c.hits, c.language, c.level,
c.lft, c.metadata, c.metadesc, c.metakey, c.modified_time, c.note, c.params, c.parent_id,
c.path, c.published, c.rgt, c.title, c.modified_user_id
ORDER BY c.lft"
[14]=>
string(325) "SELECT falang_content.reference_field, falang_content.value, falang_content.reference_id, falang_content.original_value
FROM oyhkl_falang_content AS falang_content
WHERE falang_content.language_id=2
AND falang_content.published=1
AND falang_content.reference_id IN(1,8)
AND falang_content.reference_table='categories'"
[15]=>
string(142) "SELECT extension_id AS id, element AS "option", params, enabled
FROM oyhkl_extensions
WHERE `type` = 'component' AND `element` = 'com_content'"
[16]=>
string(1089) "SELECT a.title AS title, a.metadesc, a.metakey, a.created AS created, CONCAT(a.introtext,a.fulltext) AS text, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, c.title AS section, '2' AS browsernav
FROM oyhkl_content AS a
INNER JOIN oyhkl_categories AS c ON c.id=a.catid AND c.access IN (1,1)
WHERE ((a.title LIKE '%מלך%' OR a.introtext LIKE '%מלך%' OR a.fulltext LIKE '%מלך%' OR a.metakey LIKE '%מלך%' OR a.metadesc LIKE '%מלך%') AND (a.title LIKE '%היער%' OR a.introtext LIKE '%היער%' OR a.fulltext LIKE '%היער%' OR a.metakey LIKE '%היער%' OR a.metadesc LIKE '%היער%')) AND a.state = 2 AND c.published = 1 AND a.access IN (1,1) AND c.access IN (1,1) AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2012-11-21 17:01:20') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2012-11-21 17:01:20') AND a.language in ('he-IL','*') AND c.language in ('he-IL','*')
ORDER BY a.created DESC LIMIT 0, 49"
[17]=>
string(670) "SELECT a.name AS title, "" AS created, a.link AS text, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug,CONCAT_WS(' / ', 'מזין חדשות', c.title) AS section,"1" AS browsernav
FROM oyhkl_newsfeeds AS a
INNER JOIN oyhkl_categories as c ON c.id = a.catid
WHERE ((a.name LIKE '%מלך%' OR a.link LIKE '%מלך%') AND (a.name LIKE '%היער%' OR a.link LIKE '%היער%'))AND a.published IN (1,2) AND c.published = 1 AND c.access IN (1,1) AND a.language in ('he-IL','*') AND c.language in ('he-IL','*')
ORDER BY a.name ASC LIMIT 0, 50"
[18]=>
string(775) "SELECT a.title AS title, a.description AS text, a.created AS created, a.url, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(':', a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, CONCAT_WS(' / ', 'חיפוש - קישורי רשת', c.title) AS section, '1' AS browsernav
FROM oyhkl_weblinks AS a
INNER JOIN oyhkl_categories AS c ON c.id = a.catid
WHERE ((a.url LIKE '%מלך%' OR a.description LIKE '%מלך%' OR a.title LIKE '%מלך%') AND (a.url LIKE '%היער%' OR a.description LIKE '%היער%' OR a.title LIKE '%היער%')) AND a.state in (1,2) AND c.published=1 AND c.access IN (1,1) AND a.language in ('he-IL','*') AND c.language in ('he-IL','*')
ORDER BY a.created DESC LIMIT 0, 50"
[19]=>
string(1230) "SELECT i.title AS title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
CONCAT(i.introtext, i.fulltext) AS text,
CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug,
CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug
FROM oyhkl_catalog_items AS i
INNER JOIN oyhkl_catalog_categories AS c ON c.id=i.catid AND c.access IN(1,1)
WHERE (MATCH(i.title, i.introtext, i.`fulltext`,i.extra_fields_search,i.image_caption,i.image_credits,i.video_caption,i.video_credits,i.metadesc,i.metakey) AGAINST ('+מלך* +היער*' IN BOOLEAN MODE)
)
AND i.trash = 0
AND i.published = 1
AND i.access IN(1,1)
AND c.published = 1
AND c.access IN(1,1)
AND c.trash = 0
AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2012-11-21 17:01:20' )
AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2012-11-21 17:01:20' ) AND c.language IN ('he-IL', '*') AND i.language IN ('he-IL', '*') GROUP BY i.id ORDER BY i.created DESC LIMIT 0, 50"
}
["offset":protected]=>
int(0)
["sql":protected]=>
string(1215) "
SELECT i.title AS title,
i.metadesc,
i.metakey,
c.name as section,
i.image_caption,
i.image_credits,
i.video_caption,
i.video_credits,
i.extra_fields_search,
i.created,
CONCAT(i.introtext, i.fulltext) AS text,
CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug,
CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug
FROM #__catalog_items AS i
INNER JOIN #__catalog_categories AS c ON c.id=i.catid AND c.access IN(1,1)