需要你的帮助,很奇怪。我在本地和服务器上有相同的表 - 服务器上的表不会增加?本地的...这是colum的SQL语句。我只能在没有数据的情况下注册/输入一行,然后在下一次提交时不会自动递增:
-- phpMyAdmin SQL Dump
-- version 3.3.9.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 25, 2011 at 01:31 PM
-- Server version: 5.0.92
-- PHP Version: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `name`
--
-- --------------------------------------------------------
--
-- Table structure for table `basic`
--
CREATE TABLE IF NOT EXISTS `basic` (
`user_id` int(11) NOT NULL auto_increment,
`username` varchar(255) character set utf8 NOT NULL,
`email` varchar(255) character set utf8 NOT NULL,
`email_active` enum('1','0') character set utf8 NOT NULL default '0',
`password` varchar(128) character set utf8 NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `basic`
--
INSERT INTO `basic` (`user_id`, `username`, `email`, `email_active`, `password`) VALUES
(2, 'mrd', 'ddddd.ddddd@gmail.com', '0', '05cb6e7ad0f2a84ee6b1cc097dbf2787');
为什么它在本地运作? (我在服务器和本地使用PHP我的管理员)
谢谢...
答案 0 :(得分:2)
确保设置AUTO_INCREMENT
标志:
CREATE TABLE users
(
user_id int NOT NULL AUTO_INCREMENT,
username varchar(255) NOT NULL,
email varchar(255) UNIQUE,
email_active TINYINT(1),
password varchar(12),
PRIMARY KEY (user_id)
)