# random number

Page 1 of 1

## 14 Replies - 415 Views - Last Post: 13 September 2013 - 03:11 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=328995&amp;s=0dfb9165bbf7fa7636fe51b76ce802ae&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 rintucugete

Reputation: -1
• 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

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• 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"?

### #3 rintucugete

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

## Re: random number

Posted 13 September 2013 - 01:52 AM

Dormilich, 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..

### #4 Dormilich

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• Joined: 08-June 10

## Re: random number

Posted 13 September 2013 - 01:53 AM

but these are not random numbers.

### #5 rintucugete

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

## Re: random number

Posted 13 September 2013 - 02:01 AM

Dormilich, 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?

### #6 Dormilich

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• 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.

### #7 rintucugete

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

## Re: random number

Posted 13 September 2013 - 02:11 AM

Dormilich, 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

### #8 Dormilich

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• Joined: 08-June 10

## Re: random number

Posted 13 September 2013 - 02:15 AM

in the DB, is it an auto_increment ID?

### #9 rintucugete

Reputation: -1
• 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

### #10 Dormilich

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• 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

### #11 rintucugete

Reputation: -1
• 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

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

### #12 Dormilich

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• Joined: 08-June 10

## Re: random number

Posted 13 September 2013 - 02:30 AM

do it the same way as with 8501.

### #13 rintucugete

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

## Re: random number

Posted 13 September 2013 - 02:32 AM

Dormilich, 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?

### #14 Dormilich

• 痛覚残留

Reputation: 3681
• Posts: 11,058
• Joined: 08-June 10

## Re: random number

Posted 13 September 2013 - 02:36 AM

see http://stackoverflow...rement-in-mysql

### #15 Atspulgs

• D.I.C Regular

Reputation: 68
• 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;
```