add multiple attributes using checkboxgroup in phplist
Instalasi PHPList standar (seperti di laptop saya) akan menghasilkan error sebagai berikut ketika melakukan impor file (alamat email) berupa file CSV :
Database error 1054 while doing query Unknown column 'stuff2' in 'where clause' |
Error tersebut muncul ketika terdapat sebuah kolom dengan banyak attribute (value). Solusinya adalah dengan menambahkan option [case] pada file importcsv.php yg terletak di /admin/commonlib/pages – line 650
Berikut adalah kode yg harus ditambahkan supaya proses import berhasil dilakukan :
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | case "checkboxgroup": $cbg_ids = array(); $cbg_item = explode(";",$uservalue); $cbg_idx = 0; if ($uservalue !== "") while ($cbg_idx < sizeof($cbg_item)) { $val = Sql_Query("select id from $table_prefix"."listattr_$att[1] where name = \"$cbg_item[$cbg_idx]\""); # if we do not have this value add it if (!Sql_Affected_Rows()) {Sql_Query("insert into $table_prefix"."listattr_$att[1] (name) values(\"$cbg_item[$cbg_idx]\")"); Warn("Value $cbg_item[$cbg_idx] added to attribute $att[2]"); array_push($cbg_ids,Sql_Insert_Id()); } else { $d = Sql_Fetch_Row($val); array_push($cbg_ids,$d[0]); } $cbg_idx++; } $user_att_value = implode(",",$cbg_ids); break; |
Diskusi lengkap bisa dilihat di sini :
http://forums.phplist.com/viewtopic.php?p=57820#57820
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!