I am trying to pull information from a csv file on my server and place it into a mysql table. I am able to pull the file using fopen and fgetcsv and get the following to display:
Array
[1] 7/23/2011
[2] 22012
[3] 100005
Array
[1] 7/23/2011
[2] 21022
[3] 100006
In this scenario [2] would be a campaign number I am pulling from a network. When I enter this in to mysql I need to assign a value to it to place in another column in the database.
So basically it would loop through the arrays and say if
[2]=22012 then $price=1.00
or if
[2]=21022 $price=1.50
and so on for several other numbers.
I had written the if statement and was able to assign a value to $price but when I echo the statement to see if it's working right it only shows the first array and no others and will only display what is in $price but not any other fields. And will only show the price for the first, but not any others.
Sorry if this is something simple but I am fairly new to all of this and have been trying to figure it out for 3 days on my own.
Thanks in advance for any help you can give.
Array
[1] 7/23/2011
[2] 22012
[3] 100005
Array
[1] 7/23/2011
[2] 21022
[3] 100006
In this scenario [2] would be a campaign number I am pulling from a network. When I enter this in to mysql I need to assign a value to it to place in another column in the database.
So basically it would loop through the arrays and say if
[2]=22012 then $price=1.00
or if
[2]=21022 $price=1.50
and so on for several other numbers.
I had written the if statement and was able to assign a value to $price but when I echo the statement to see if it's working right it only shows the first array and no others and will only display what is in $price but not any other fields. And will only show the price for the first, but not any others.
Sorry if this is something simple but I am fairly new to all of this and have been trying to figure it out for 3 days on my own.
Thanks in advance for any help you can give.