Jump to content


Photo

auto incriment


  • Please log in to reply
2 replies to this topic

#1 mbvo

mbvo
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 04 October 2006 - 05:21 PM

I'm trying to display data that no one field is required to be unique, so I want to make an automatic field that contains a number.  but there's no auto incriment data type for sql.  what do i do?

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 04 October 2006 - 05:32 PM

auto increment is not a datatype but rather an attribute. if you're wanting an auto incrementing column, just set it up in your create table statement like this:
CREATE TABLE myTable (
  id int(11) auto_increment primary key
  -- continue your table on here --

You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 04 October 2006 - 07:43 PM

And you should make it UNSIGNED.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users