Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PHP/MySQL]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun May 04, 2008 4:43 pm    Post subject: [PHP/MySQL] Reply with quote

Well i want to know how i can set a unique ID to each input into the database...

For example, the first input is 1, the second is 2, and so on and so on... Thanks Smile

_________________
Back to top
View user's profile Send private message MSN Messenger
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Sun May 04, 2008 5:15 pm    Post subject: Reply with quote

I'm not sure what you mean, but:
Let's say there's a table like that:
Code:

ID:                  NAME:
__________________________
1                    rEakW0n
2                    lolhax


And you want that the query does take the next ID by itself?
So if someone creates the next entry that it takes ID=3 ?
If so, there's a simple MySQL query for that:
Code:
SELECT MAX(ID) AS total FROM <table>

Just take the result of 'total'+1 then.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun May 04, 2008 5:27 pm    Post subject: Reply with quote

You can set table variables to auto-increment as well which will handle the values for you.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun May 04, 2008 5:48 pm    Post subject: Reply with quote

Can you not just set a primary key for this?
Back to top
View user's profile Send private message MSN Messenger
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun May 04, 2008 8:45 pm    Post subject: Reply with quote

ah yes i did auto-inc.

Thanks Smile

_________________
Back to top
View user's profile Send private message MSN Messenger
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Mon May 05, 2008 4:19 am    Post subject: Reply with quote

noz3001 wrote:
Can you not just set a primary key for this?


Yea, but primary-key will just avoid a double entry of a certain value in a field (or more).

I didn't know about auto-increase yet Smile thanks
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Mon May 05, 2008 12:23 pm    Post subject: Reply with quote

rEakW0n wrote:
noz3001 wrote:
Can you not just set a primary key for this?


Yea, but primary-key will just avoid a double entry of a certain value in a field (or more).

I didn't know about auto-increase yet Smile thanks


Primary Keys have always auto incremented when i've use them on the ID attribute.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites