开发者

sql: making a table structure for injections

I want to take the values from this site for the country table in my database.

The problem is that they don't provide the table structure, so I have to create one, but I cannot get it right - my phpMyAdmin keeps displaying an error when I want to inject the data into the table I created below:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NUMERIC, alpha3, name, officialName) VALUES ('004','AFG','Afghanistan','Afghan' at line 1

--
-- Table structure for table `countrytable`
--

CREATE TABLE IF NOT EXISTS `countrytable` (
  `NUMERIC` int(11) NOT NULL,
  `alpha3` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `officialName` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I think my table structure is incorrect. How can I fix开发者_如何学C it? Thanks!


Try all varchar fields to get the data in since all fields are in quotes in the string you have.


NUMERIC is reserved word in mysql
add in back-tick or quote it -> http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html


`alpha3` should be a varchar(3) (or larger), not an int(11).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜