Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2008
    Location
    UK. America sucks!
    Posts
    310
    Tokens
    0

    Default MySQL help needed

    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 :]

    if PHP is peanut butter...then...MySQL would be the jelly. Together they can make one heck of a good sandwich.

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    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/mascon...eld_Types.html


    PHP Code:
    CREATE TABLE `drift_userdb`.`tablename` (
    `
    idBIGINT NOT NULL AUTO_INCREMENT ,
    `
    md5TEXT NOT NULL ,
    `
    noTEXT NOT NULL ,
    PRIMARY KEY ( `id` ) ,
    UNIQUE (`md5`)
    ENGINE MYISAM 
    etc.
    Hi, names James. I am a web developer.

  3. #3
    Join Date
    Mar 2008
    Location
    UK. America sucks!
    Posts
    310
    Tokens
    0

    Default

    thx +rep

    if PHP is peanut butter...then...MySQL would be the jelly. Together they can make one heck of a good sandwich.

  4. #4
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    No problem.
    Hi, names James. I am a web developer.

  5. #5
    Join Date
    Mar 2008
    Location
    UK. America sucks!
    Posts
    310
    Tokens
    0

    Default

    #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?

    if PHP is peanut butter...then...MySQL would be the jelly. Together they can make one heck of a good sandwich.

  6. #6
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    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"
    Hi, names James. I am a web developer.

  7. #7
    Join Date
    Mar 2008
    Location
    UK. America sucks!
    Posts
    310
    Tokens
    0

    Default

    Tried it, didn't work.

    if PHP is peanut butter...then...MySQL would be the jelly. Together they can make one heck of a good sandwich.

  8. #8
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    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.
    Hi, names James. I am a web developer.

  9. #9

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •