0
我必須保存到表中的數據的數量:限制到其他表
tb_document tb_sentence
================= ===========================================
|doc_id|document| | id | sentence_id |sentence | doc_id|
================= ===========================================
我想從tb_document
採取document
數據。數據是文本,然後將數據解析成句子。 我只需要爲tb_sentence中的每個文檔存儲最多50個句子。
下面的代碼:
foreach ($content as $doc_id => $sentences){ //$content is variable that save document from tb_document
$i = 0;
foreach(preg_split('/\\.\\s*/', $sentences) as $current_sentence){
$q = mysql_query("INSERT INTO tb_sentence SET doc_id = {$doc_id}, sentence_id = {$i}, sentence = '{$current_sentence}'") or die(mysql_error());
$i<51; $i++;
}
}
,但是,它仍然保存完整的數據。請幫幫我。謝謝:)
'$ i <51'應該做什麼? –
@lc。我想存儲最多50個current_sentence –