Jump to content

Increment Question?


barkster

Recommended Posts

I'm trying to figure out the best way to increment a field and return the new number back to the users. I'm trying to keep track of who contacted a user first and need to number them.  I want the first user to contact a user to be number one and so on but want to make sure the fastest and most reliable way to do it.  Any suggestions?  Thanks
Link to comment
Share on other sites

Ok I'll try and explain a little better

I have a Table called Topics in which users respond to the topic.  When they respond I need to be able to track who responded first, second, third, etc...  When a users responds I need to increment some field and use that number to send out an email so the topic starter will know who contacted them first.  I know they can just sort their emails by received but I need to have this number as the first character in the subject for future reference.  I have now idea on how to implement this without doing extensive amount of queries.  I'm looking for one - two queries max.  If I could do a UPDATE Topics SET Count=(Count+1) and get the original count all in the same query that would work for me I think but don't know how
Link to comment
Share on other sites

Datetime might work for somebody who isn't trying do what I'm trying to do.  If you know a way to convert a datetime into a number then I'm all ears.  I would love to know how to do what I'm trying to do with a datetime field, doesn't accomplish a numbering scheme. I'm sure I could do it if I inserted a record using a datetime, then do a lookup and somehow figure out what position they are in the recordset?
Link to comment
Share on other sites

You can always unix_timestamp() your datetime field to get an integer value.  And yes, the idea is that you record the date/time for every reply to a topic, and then run a simple query to find the earliest date for a particular thread.  I don't see what the problem is.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.