我想保存到一個數據庫,我需要實現一個系統,其中用戶可以指定在給定的表中的字段數據必須保存。列計數不匹配在第1行與2個相同長度的數組的值計數
在我的測試中,我已經嘗試了以下,一切運行良好:
$v = $rowdata; // array with the data to be saved
$r = "field1,field2,field3"; // fields of the table in which to save
,我準備與字段的名稱的數組,我已經把它放在原結構:
$v = $rowdata; // data to be saved
$r = $tablefields; // fields of the table to populate
但後來我得到以下信息:
Column count doesn't match value count at row 1
我的print_r和T檢查他兩個數組($ rowdata和$ tablefields)的元素數量完全相同。 任何想法,爲什麼我得到這個錯誤?
什麼查詢樣子? – tomsv
如果您發佈創建查詢的代碼會更好。我相信這個查詢要麼是格式不正確的,要麼是列數不匹配。 – seeker
認爲'count(explode(「,」,$ r))''比'count($ v)'更''''。 使用'var_dump'並檢查爲什麼... –