2012-07-10 31 views
0

我已經從myisam遷移到innodb,我不得不從表中刪除全文索引。 現在我的腳本的某些部分不起作用,我如何轉換下面的代碼,以便它將與innodb一起使用?PHP:轉換MySQL代碼,以便它可以與innodb一起使用?

$posts_fields = "SELECT SQL_CALC_FOUND_ROWS id, autor, " . PREFIX . "_post.date AS newsdate, " . PREFIX ."_post.date AS date, short_story AS story, " . PREFIX . "_post.xfields AS xfields, title, descr, keywords, category, alt_name,comm_num AS comm_in_news, allow_comm, rating, news_read, flag, editdate, editor, reason, view_edit, tags, '' AS output_comms"; 
$posts_from = "FROM " . PREFIX . "_post"; 
$sql_find = "$sql_fields $posts_from $where"; 
+3

什麼不工作了?如果你正在使用'MATCH(..)AGAINST(..)',那麼問題很可能出現在'$ where'中。 – 2012-07-10 14:48:11

+3

MySQL 5.6支持InnoDB表上的FULLTEXT索引:http://dev.mysql.com/tech-resources/articles/mysql56-labs-july2011.html。這就是說,你的PHP沒用 - 告訴我們生成的查詢字符串是什麼樣的。 – 2012-07-10 14:49:17

+1

所有代碼都是從表中選擇一個字段列表。沒有代碼會依賴於存儲引擎,也沒有代碼依賴於索引,FULLTEXT或其他。請在嘗試運行查詢時顯示您收到的錯誤消息。 – DaveRandom 2012-07-10 14:49:37

回答

0
$posts_fields = "SELECT SQL_CALC_FOUND_ROWS id, autor, " . PREFIX . "_post.date AS newsdate, " . PREFIX ."_post.date AS date, short_story AS story, " . PREFIX . "_post.xfields AS xfields, title, descr, keywords, category, alt_name,comm_num AS comm_in_news, allow_comm, rating, news_read, flag, editdate, editor, reason, view_edit, tags, '' AS output_comms"; 
$posts_from = "FROM " . PREFIX . "_post"; 
$sql_find = "$sql_fields $posts_from $where"; 

應改爲

$posts_fields = "SELECT SQL_CALC_FOUND_ROWS id, autor, " . PREFIX . "_post.date AS newsdate, " . PREFIX ."_post.date AS date, short_story AS story, " . PREFIX . "_post.xfields AS xfields, title, descr, keywords, category, alt_name,comm_num AS comm_in_news, allow_comm, rating, news_read, flag, editdate, editor, reason, view_edit, tags, '' AS output_comms"; 
$posts_from = "FROM " . PREFIX . "_post"; 
$sql_find = "$post_fields $posts_from $where"; 

,並仔細檢查您的where條件

+0

nope沒有工作 – 2012-07-10 19:09:45

相關問題