我從表單輸入的文字和圖片如何將兩個數組拼成一個單一字符串以插入mysql值?
正在收集兩個數組$final = array($info, $paths);
print_r($final);
此打印
Array ([0] => Array ([0] => '1995', [1] => 'chevrolet', [2] => 'impala', [3] => '5.7', [4] => 'bose', [5] => '165465', [6] => 'sadfasdf', [7] => '', [8] => '', [9] => 'asdfasdasdf', [10] => '', [11] => '', [12] => 'sdafasdfasd', [13] => '', [14] => '', [15] => '', [16] => '', [17] => 'asdfasdf',) [1] => Array ([0] => 'images/picture22677.png', [1] => 'images/picture22678.png', [2] => 'images/picture22679.jpg',))
完美! 但我怎麼現在這個$final
數組轉換成這樣
'$value', '$value', '$value', '$value',
但出數組一個字符串鍵數 更好地瞭解我,我需要一個字符串,我可以finnaly插入MySQL的,像這樣
mysql_query("INSERT INTO
auto(year, make, model, engine, sound_system, mileage, att1, att2,
att3, att4, att5, att6, att7, att8, att9, att10, att11, att12, att13, att14, att15, picture1,
picture2, picture3, picture4, picture5, picture6, picture7, picture8, picture9,
picture10, picture11, picture12)
VALUES
($finalpaths));
看到VALUES ($finalpaths));
這裏就是我需要有數組列表轉換爲字符串,將在這種情況下工作
我希望你明白了我所需要的,感謝您的inpu t :)
有2級陣列的目的是什麼,以及如何轉換到您的預期輸出? – jcsanyi