I got an array inside a php programm that looks like this:
$db=Array ( [1] => 1 [2] => 2 [3] => 2 [4] => 2 [5] => 3 [6] => 4 [7] => 4 [8] => 5 );
It is an associative array, and I want to store it in my mysql database with this structure:
id date fd1 fd2 fd3 fd4 fd5 fd6 fd7 fd8
mysql_query("INSERT INTO table2 (date) VALUES(NOW(),'$db')");
id is set to AUTO_INCREASE and NOW() stores the date for every entry
But my main problem is how to assign array field [1] to fd1 column and post “value” in it
Any Help appreciated
EDIT:
there’s no impact for speed here. you can also use implode instead