Du måste ange kolumnernas namn först.
INSERT INTO users (kolumn1, kolumn2, kolumn3) VALUES('varde1','varde2','varde3');
2 svar · 292 visningar · startad av KarlTomas
Hej, det är första gången jag provar mysql och php.
Jag hittade ett script som jag intresserad av och försöker att installera det på min dator.
Jag följer installationsinstruktionerna av scriptet, men när jag ska skapa en ny användare så får jag följande fel:
mysql> use mysql;
Database changed
mysql> insert into user values ('localhost', 'vote', password('vote'), 'Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N');
ERROR 1136: Column count doesn't match value count at row 1
mysql>
Jag har sökt på internet och här på webforum efter en lösning, men jag vet inte vad som är fel.
Utrustning:
Win XP pro
Apache 2.0.45
PHP 4.3.2
MySQL 4.0.13
Du måste ange kolumnernas namn först.
INSERT INTO users (kolumn1, kolumn2, kolumn3) VALUES('varde1','varde2','varde3');
Hmm... tack, men hur ska jag veta vilka namn dom ska ha, och är det inte så att någon kolumn har ett ID?
Så här står det in install.txt:
To install, you will first need the following already installed:
* Linux (this may work on Windows, but I have never tried)
* Apache webserver
* PHP3 extensions to the apache web server. PHP4 will also work, but
you will need to configure it to understand ".php3" as the proper
MIME type.
* MySQL
Add a user to MySQL named "webuser". You can do this with the following
commands:
mysql -u root -p
<enter your MySQL root password>
use mysql;
insert into user values ('localhost', 'vote', password('vote'), 'Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N');
flush privileges;
exit
This creates a user with the name "vote" and the password "vote". This user
can only log in from the local system. This is secure enough for most people.
If you change the password or username, be sure to also change them in the
file prep.php3
Run the MySQL script. This will create a database, table, and index. It
will also grant read/write/update/delete access to the user "vote". You
can do this with:
mysql -u root -p < vote.sql
Och så här ser filen vote.sql ut:
create database vote;
use vote;
create table user (
id int auto_increment primary key,
uid varchar(32) not null,
pwd varchar(32) not null,
picurl varchar(255) not null,
datecreated datetime not null,
sex char(1) not null,
active int not null default 1,
inrotation int not null default 1,
blocked int not null default 0,
datepicvalid datetime null,
voteaverage int not null default 0,
votecount int not null,
vote1 int not null default 0,
vote2 int not null default 0,
vote3 int not null default 0,
vote4 int not null default 0,
vote5 int not null default 0,
vote6 int not null default 0,
vote7 int not null default 0,
vote8 int not null default 0,
vote9 int not null default 0,
vote10 int not null default 0,
bonks int not null default 0,
selfvote int not null
);
create unique index uk_user on user (uid);
grant select,update,insert on user to vote;