PDA

View Full Version : MySQL help needed



Fugato
23-04-2008, 06:19 AM
I want to make a MySQL table called `md5` and `no`... I also need to stop duplicate entries from getting in. How would I do that?

Help appreciated :]

Protege
23-04-2008, 06:50 AM
To make a table(s) I'd suggest reading this.

http://www.tizag.com/mysqlTutorial/mysqltables.php

Read most of the page, especially 'PRIMARY KEYS', using BIG Int or SMALL with 'AUTO_INCREMENT' (When an entry is added, the number goes up UNIQUELY)

This link below will explain the field types;
http://help.scibit.com/Mascon/masconMySQL_Field_Types.html




CREATE TABLE `drift_userdb`.`tablename` (
`id` BIGINT NOT NULL AUTO_INCREMENT ,
`md5` TEXT NOT NULL ,
`no` TEXT NOT NULL ,
PRIMARY KEY ( `id` ) ,
UNIQUE (`md5`)
) ENGINE = MYISAM


etc.

Fugato
23-04-2008, 07:19 AM
thx +rep

Protege
23-04-2008, 10:37 AM
No problem.

Fugato
23-04-2008, 02:50 PM
#1170 - BLOB/TEXT column 'md5' used in key specification without a key length comes up when I try to enter


CREATE TABLE `md5` (
`id` BIGINT NOT NULL AUTO_INCREMENT ,
`md5` TEXT NOT NULL ,
`no` TEXT NOT NULL ,
PRIMARY KEY ( `id` ) ,
UNIQUE (`md5`)
) ENGINE = MYISAM

Can you fix it?

Protege
23-04-2008, 03:16 PM
I don't usually make them by hand I use phpMyAdmin to create them but maybe because you've called the table "md5" and the column "md5"

Fugato
23-04-2008, 06:27 PM
Tried it, didn't work.

Protege
23-04-2008, 09:52 PM
It's something you have to play around with to get used to it, if something goes wrong for me, I usually play around with it till it works.

JustHostGlenn
23-04-2008, 11:40 PM
Try renaming your table/column... MD5 is a function in both SQL and PHP which under normal circumstances would mean it can't be used as a name for any entity/instance.

Want to hide these adverts? Register an account for free!