for pset8 , i want to insert places,like this,

while ($data=fgetcsv($file,0,"\t")) {   //"\t" is string includes only one character
      // echo $data[3]."\n";
      $result=query("INSERT INTO places (country_code,postal_code,place_name,admin_name1,admin_code1,admin_name2,admin_code2,admin_name3,admin_code3,latitude,longitude,accuracy) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",$data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7],$data[8],$data[9],$data[10],$data[11]);
      if ($result===FALSE) {
        echo "database inserting error";

i deliberately omit "id" , like the example in pset7. ,but it report error,

Fatal error: Column count doesn't match value count at row 1

below is database structure:

Error sreenshot

  • 1
    you have more question marks than corresponding arguments. – kzidane Jul 25 '15 at 9:59
  • o..i was a fool., i have counted for several times, i count it to 12, but it's actually 16. thanks – Sammy Jiang Jul 25 '15 at 13:30

You must log in to answer this question.

Browse other questions tagged .