所以我只是所有这些PHP内容的初学者。我只知道基础知识,当我为新表设置设置时,我遇到了问题#1075。之前,我创建了一个,几乎与此类似,我没有看到差异。你能告诉我问题出在哪里并解释发生了什么吗?
CREATE TABLE `try`.`testing` ( `id` INT NOT NULL AUTO_INCREMENT , `date` DATE NOT NULL , `text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , `text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ) ENGINE = MyISAM;
这是我的SQL预览的代码。我明显使用phpMyAdmin。 请帮我。 谢谢,你)
答案 0 :(得分:1)
试试这个
CREATE TABLE `testing` (
`id` INT NOT NULL AUTO_INCREMENT,
`date` DATE NOT NULL,
`text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = MYISAM ;
答案 1 :(得分:1)
您必须将 public function productgroups()
{
return $this->belongsToMany('App\ProductGroups',
'product_productgroup',
'product_apk',
'productgroup_id');
}
字段声明为var express = require('express');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var app = express();
var port = process.env.PORT || 3000;
app.get('/', function(req, res) {
res.render('index.ejs');
});
app.get('/login', function(req, res) {
console.log('login /GET');
res.render('login.ejs');
});
passport.use('local', new LocalStrategy({
usernameField : 'username',
passwordField : 'password'
},
function(username, password, done) {
console.log('local strategy');
return done(null, {username : 'username'});
}
));
app.post('/login', function(req, res, next){
passport.authenticate('local', function(err, user, info) {
console.log('auth run');
if (err) {
return next(err);
}
if (!user) {
return res.redirect('/login');
}
req.logIn(user, function(err) {
if (err) { return next(err); }
return res.redirect('/users/' + user.username);
});
})(req, res, next);
});
app.listen(port);
console.log('listenting http://localhost:' + port);
或AUTO_INCREMENT
。因此,您必须在primary key
声明中添加key
或PRIMARY KEY (id)
:
KEY (id)
请检查:
答案 2 :(得分:0)
对于autoincrement
字段,您应该有某种与之关联的索引。例如:primary key
缺少
答案 3 :(得分:0)
试试这个。
CREATE TABLE `try`.`testing` (
`id` INT NOT NULL AUTO_INCREMENT,
`date` DATE NOT NULL ,
`text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
KEY (`id`)
) ENGINE = MyISAM;
https://dev.mysql.com/doc/refman/5.6/en/example-auto-increment.html