I have an array $playernames
which holds different player names. Im trying to extract the values and upload them to a database one query per time, as such:
for ($i=0; sizeof($playername) > $i; $i++)
{
$name = $playername[$i];
$query = mysql_query(
"INSERT INTO `team`(`fixture_id`,`player_name`
)
VALUES ($id, '$name')") or die(mysql_error());
}
However what now happens now is after every query in the loop the data gets overwrited in the name colum of database. After execution when I open the DB only the name of the last player contained in the array is displayed.
What am I doing wrong? Thanks in advance. (sorry if this question touches on duplicate but I've not seen a clear explanation regarding above problem)