I want to read the sql file through php to create the database and write some initial data, so I wrote the following php code and sql
after the first floor hint, the code has run
array (size=5)
0 => string "CREATE DATABASE IF NOT EXISTS wishwall DEFAULT CHARACTER SET "UTF8"" (length=67)
1 => string "
USE wishwall" (length=16)
2 => string "
CREATE TABLE IF NOT EXISTS message (
`id` INT UNSIGNED AUTO_INCREMENT KEY COMMENT "",
`username` VARCHAR(20) NOT NULL UNIQUE COMMENT "",
`posttime` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT "",
`bgcolor` VARCHAR(10) DEFAULT "-sharpFFDFFF" COMMENT "",
`content` VARCHAR(200) NOT NULL COMMENT ""
)ENGINE=INNODB CHARSET=UTF8" (length=394)
3 => string "
INSERT message(username,content) VALUES
("A",""" "" "),
("",""),
("",""),
("",""),
("","")" (length=489)
4 => string "
" (length=2)
there are two questions that are wrong:
- the comments of the created message table are garbled
The- table is created, but the initial data is not written (there is no problem with the INSERT statement, which can be successful on the mysql command line)
- if you want to write comments in sql, will it affect reading? there can be no carriage returns or line feeds in sql?