Bu kod, Cat ve Purr'u eklemeye çalıştığımda bana hata veriyor. Öğreticide çift tırnak işareti yoktu, ancak kodları da çalışmadı. Bu bir çeşit sözdizimi sorunu olmalı. Ayrıştırma hatası: sözdizimi hatası, beklenmedik 'uç' (T_STRING) C: Burada Sözdizimi hatası php ve sqlite ekleme deyimi
message('creating the db Object');
$db = new bwSQLite3(DB_FILENAME, TABLE_NAME);
$tn = TABLE_NAME;
message('creating the table');
$db->sql_do("Drop table if exists $tn");
$db->sql_do("create table $tn (id integer primary key, animal text, sound text)");
//insert some records
$db->sql_do("insert into $tn (animal, sound) values (?, ?), 'cat', 'Purr' "); //right here issues
$db->sql_do("insert into $tn (animal, sound) values (?, ?), 'dog', 'Woof' ");
$db->sql_do("insert into $tn (animal, sound) values (?, ?), 'duck', 'Quack' ");
$db->sql_do("insert into $tn (animal, sound) values (?, ?), 'bear', 'Grr' ");
message('there are %d rows in the table', $db->count_recs());
}catch (PDOException $e) {
error($e->getMessage());
}
hata \ xampp \ htdocs \ ExerciseFiles \ Chap01 \ create.php hattında 42
Sorunuzun Hatanızı ekleyiniz:
Ayrıca farkı görmek için bu deneyin, PHP dizeleri ile nasıl çalıştığını anlamıyorum gibi geliyor. –
Ayrıştırma hatası: sözdizimi hatası, beklenmedik 'insert' (T_STRING) C: \ xampp \ htdocs \ ExerciseFiles \ Chap01 \ create.php satırında 42 – DDJ