When uploading data to mysql I get this error:
#1054 - Unknown column 'aid' in 'field list' "
This is the part in which I'm getting error #1054
CREATE TABLE IF NOT EXISTS `admin` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`aname` varchar(30) DEFAULT NULL,
`amail` varchar(30) DEFAULT NULL,
`anumber` varchar(30) DEFAULT NULL,
`aip` varchar(30) DEFAULT NULL,
`apass` varchar(50) DEFAULT NULL,
`atime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`city` varchar(30) NOT NULL,
`fb` varchar(100) NOT NULL,
`other` varchar(100) NOT NULL,
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`aid`, `aname`, `amail`, `anumber`, `aip`, `apass`, `atime`, `city`, `fb`, `other`) VALUES
(1, 'M SaeeD KhaN NiaZi', 'mianwali@gmail.com', '03437517173', '::1', 'niazi', '2015-07-14 23:00:00', 'MiAnWaLi PAKisTaN', 'www.facebook.com', 'BhAnGi BhAi');
Your query works fine, as long as the table does not exist yet:
CREATE TABLE IF NOT EXISTS `admin` (
^^^^^^^^^^^^^
You can verify current table in a number of ways, eg:
show columns from admin;
show create table admin;
select * from admin limit 1;
You can also add a show warnings;
statement right after the create table
one:
mysql> show warnings;
+-------+------+------------------------------+
| Level | Code | Message |
+-------+------+------------------------------+
| Note | 1050 | Table 'admin' already exists |
+-------+------+------------------------------+
1 row in set (0.00 sec)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.