14 Replies - 342 Views - Last Post: 13 September 2013 - 03:11 AM Rate Topic: -----

#1 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

random number

Posted 13 September 2013 - 01:45 AM

How to create a random number in an incremented manner?
Is This A Good Question/Topic? 0
  • +

Replies To: random number

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 01:47 AM

can you elaborate on how I have to understand of an "incremented manner"?
Was This Post Helpful? 0
  • +
  • -

#3 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

Re: random number

Posted 13 September 2013 - 01:52 AM

View PostDormilich, on 13 September 2013 - 01:47 AM, said:

can you elaborate on how I have to understand of an "incremented manner"?



example;8000,8001,8002... etc..
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 01:53 AM

but these are not random numbers.
Was This Post Helpful? 0
  • +
  • -

#5 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

Re: random number

Posted 13 September 2013 - 02:01 AM

View PostDormilich, on 13 September 2013 - 01:53 AM, said:

but these are not random numbers.



MY project is to create registration id for each one starting from 8000.
When user submit the registration details,reg id have to create.
How its possible?
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 02:03 AM

is this registration ID somehow tied to a DB (like a user ID) or used somewhere else?

I think randomness is not what you want here.
Was This Post Helpful? 0
  • +
  • -

#7 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

Re: random number

Posted 13 September 2013 - 02:11 AM

View PostDormilich, on 13 September 2013 - 02:03 AM, said:

is this registration ID somehow tied to a DB (like a user ID) or used somewhere else?

I think randomness is not what you want here.


Yes I have to save in Db also. Reg id also unique key
Was This Post Helpful? 0
  • +
  • -

#8 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 02:15 AM

in the DB, is it an auto_increment ID?
Was This Post Helpful? 0
  • +
  • -

#9 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

Re: random number

Posted 13 September 2013 - 02:19 AM

Yes but its from 1 to infinite. I need like this
eg:
cugete/college/8500
cugete/college/8501
cugete/college/8502
etc...

This post has been edited by Dormilich: 13 September 2013 - 02:28 AM

Was This Post Helpful? 0
  • +
  • -

#10 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 02:22 AM

just add 8500 to the DB user ID.

This post has been edited by Dormilich: 13 September 2013 - 02:29 AM

Was This Post Helpful? 0
  • +
  • -

#11 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

Re: random number

Posted 13 September 2013 - 02:30 AM

but how can i get like this

rintu/coll/1000
rintu/coll/1001


how to add?

This post has been edited by Dormilich: 13 September 2013 - 02:31 AM

Was This Post Helpful? 0
  • +
  • -

#12 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 02:30 AM

do it the same way as with 8501.
Was This Post Helpful? 0
  • +
  • -

#13 rintucugete  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 24
  • Joined: 13-September 13

Re: random number

Posted 13 September 2013 - 02:32 AM

View PostDormilich, on 13 September 2013 - 02:30 AM, said:

do it the same way as with 8501.


How to give initial value in Db from 8000?
Was This Post Helpful? 0
  • +
  • -

#14 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3550
  • View blog
  • Posts: 10,319
  • Joined: 08-June 10

Re: random number

Posted 13 September 2013 - 02:36 AM

see http://stackoverflow...rement-in-mysql
Was This Post Helpful? 0
  • +
  • -

#15 Atspulgs  Icon User is offline

  • D.I.C Regular

Reputation: 68
  • View blog
  • Posts: 380
  • Joined: 29-July 09

Re: random number

Posted 13 September 2013 - 03:11 AM

You can always check out the manual.

Thats for creating the table. Heres a small example how to create a table with auto-inctement value set.
CREATE TABLE mytable ('id' INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, 'another_field' INT) AUTO_INCREMENT 8500;


If your table is created already then just follow the link Dormilich provided.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1