Hi all,
Just curious why this works:
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE){
$import="INSERT into $prodtblname ($csvheaders1) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]')";
}
And this does not:
$headdata_1 = "'$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]'";
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE){
$import="INSERT into $prodtblname ($csvheaders1) values($headdata_1)";
}
it puts $data[#'s] in the database fields instead of the actual data that '$data[0]','$data[1]'... relates to.
I wrote a script to create the values in $headdata_1 based on the number of headers in $csvheaders1 but can't seem to get it working in the sql statement.
Thanks