0
所以,我一直在這個代碼的工作一段時間,但我放棄了,並伸出你們的幫助。我一直在尋找MongoDB和PHP的文檔,但我找不到任何東西。我想要做的就是把示例代碼插入一條記錄:MongoDB插入一個記錄不工作,因爲它應該
$obj = array("title" => "Calvin and Hobbes", "author" => "Bill Watterson");
,並重新目的是爲我的項目(如圖所示):
$obj = array($startCol => $startRow);
的事情是,$ startCol和$ startRow是數組,每次我想運行文檔時都會出現問題。有沒有什麼可笑的簡單我在這裏失蹤?提前致謝。
的多數民衆贊成給我的問題代碼大塊:
$maxRows= count($currentarray); //Outputs 45
$maxCols= count($currentarray[0]); //Outputs 9
$currentRow=1;
$currentCol=1;
$testing = 1;
do {
while ($currentCol<$maxCols){
$startCol[] = $currentarray[0][$currentCol];
$startRow[] = $currentarray[$currentRow][$currentCol];
$currentCol++;
}
$obj = array($startCol => $startRow);
$collection->insert($obj);
print_r ($collection);
if ($currentCol==$maxCols)
$currentCol=1;
$currentRow++;
$testing++;
//echo "<br />";
} while ($currentRow<$maxRows);
跳到我的第一件事是$收集似乎undefined – Goldentoa11 2012-03-31 17:39:50
對不起,集合被定義我只是沒有發佈它。 – EGHDK 2012-03-31 18:10:51