We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts
    Hi,

    I want to import a CSV file into a MySQL table using phpMyAdmin to later use it with the DataGrid widget.

    The first value on each row is some name (VARCHAR) and the three next values are boolean values.

    I wonder :
    - how the boolean values should be written in the CSV file (true/false, 1/0, ... ?)
    - if I can let blank content for false values, like this : granny smith apple,,,1
    - if quotes are required and if for all values or only the VARCHAR-typed field.

    Currently, my CSV file is something like :
    "fruit","can_be_red","can_be_yellow","can_be_green"
    banana,,1
    golden apple,,1
    granny smith apple,,,1
    maigold apple,1,1
    

    Thanks for any help.
      • 15001
      • 697 Posts
      Solved.

      The file can look like this :
      banana;;1
      golden apple;;1
      granny smith apple;;1
      maigold apple;1;1

      The steps in phpMyAdmin :

      1) create a new table with the object name (for instance with type VARCHAR(25)) column
      and the boolean columns.

      2) access the table and click the "Import" tab.

      3) chose the file, the collation and the "CSV via LOAD DATA" option.

      4) click the "Execute" button. Your table is imported.