Web Wiz - Green Windows Web Hosting - Celebrating 25 Years!

  New Posts New Posts RSS Feed - Author_ID unique ID
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Author_ID unique ID

 Post Reply Post Reply Page  12>
Author
ramone_johnny View Drop Down
Groupie
Groupie


Joined: 13 May 2005
Status: Offline
Points: 87
Post Options Post Options   Thanks (0) Thanks(0)   Quote ramone_johnny Quote  Post ReplyReply Direct Link To This Post Topic: Author_ID unique ID
    Posted: 23 November 2005 at 6:25pm
HI guys,
Im trying to catch the actual unique ID of the entry taking place when a user registers on my site, then populate a second table with that value.
 
As in Author_ID = 75 > then ad 75 within the 'peoples' table as UserID.
 
Now Ive been using this bit of code and I thought It was working ok, however I have recently discovered since upgrading to sql server 8.0 that my value of user_id is null.
 
Could someone help me out with this? I desperately need to catch the unique ID of the entry taking place!
 
'******************************************
 '***     Update datbase  ***
 '******************************************
'If this is new reg and the username and email is OK or this is an update then register the new user or update the rs
If (strMode = "new" AND blnUsernameOK AND blnEmailOK AND blnSecurityCodeOK AND blnEmailBlocked = False) OR (strMode = "update" AND blnConfirmPassOK) Then
'If this is new then create a new rs and reset session variable
If strMode = "new" Then 
Session("lngSecurityCode") = null
rsCommon.AddNew
End If
               
            
'Insert the user's details into the rs
With rsCommon
                &nbs p;            
If strMode = "new" Then .Fields("Username") = strUsername
If strMode = "new" Then .Fields("Group_ID") = intForumStartingGroup
                &nbs p;       
'If part number = 0 (all) or part 1 (reg details) then run this code
If intUpdatePartNumber = 0 OR intUpdatePartNumber = 1 Then
                &nbs p;        
If (strMode = "update" AND blnPasswordChange = True) OR  strMode = "new" Then .Fields("Password") = strEncryptedPassword
If (strMode = "update" AND blnPasswordChange = True) OR  strMode = "new" Then .Fields("Salt") = strSalt
.Fields("User_code") = strUserCode
.Fields("Author_email") = strEmail
.Fields("firstname") = strFirstname
.Fields("lastname") = strLastname
       
'GET THE USERS AUTHOR_ID NUMBER
user_id = rsCommon("Author_ID")    *doesnt appear to work??????   
End If
 
 
I then use it later do to the following - however this fails as I have no value for user_id
 
'ADD TO THE PEOPLES TABLE
 
Set objRS  = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * From people;"
objRS.MaxRecords = 1 
objRS.CursorType = 2
objRS.LockType = 3
objRS.Open strSQL, adoCon
objRS.AddNew
objRS.Fields("userID") = user_id
objRS.Fields("firstname") = strFirstname
objRS.Fields("lastname") = strLastname
objRS.Update
objRS.Close
Set objRS = Nothing
     
'CREATE USERS PHOTO ALBUM FOLDER
set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists(Server.MapPath(strPath) & "/" & user_id) then
objFSO.CreateFolder Server.MapPath(strPath) & "/" & user_id
end if
Set objFSO = nothing
 
Thanks,
John
Back to Top
ramone_johnny View Drop Down
Groupie
Groupie


Joined: 13 May 2005
Status: Offline
Points: 87
Post Options Post Options   Thanks (0) Thanks(0)   Quote ramone_johnny Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2005 at 6:35am
anyone????? Cry
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2005 at 6:42am
you have to requery the database to get the new userID

apart from that im not to funiliar with V8.0 but should be ok the aboce idea
Back to Top
ramone_johnny View Drop Down
Groupie
Groupie


Joined: 13 May 2005
Status: Offline
Points: 87
Post Options Post Options   Thanks (0) Thanks(0)   Quote ramone_johnny Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2005 at 6:52am
Any chance of an example? Ive spent two days on this without any joy. Cry
Back to Top
ramone_johnny View Drop Down
Groupie
Groupie


Joined: 13 May 2005
Status: Offline
Points: 87
Post Options Post Options   Thanks (0) Thanks(0)   Quote ramone_johnny Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2005 at 7:10am
All I need is the unique ID of the actual entry taking place when a user registers.
 
Author_ID = ????
Back to Top
ramone_johnny View Drop Down
Groupie
Groupie


Joined: 13 May 2005
Status: Offline
Points: 87
Post Options Post Options   Thanks (0) Thanks(0)   Quote ramone_johnny Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2005 at 7:26am

Well im off to bed - its 11:00pm here. If anyone could help me on this I would really appreciate it. As I said, Ive spent a considerable amount of time on this without any luck.

See everyone tomorrow with hopefully some answers!
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2005 at 7:33am
yes you need ot requery getting the last record order by author_ID DESC

then bring that value into your server verible
Back to Top
ramone_johnny View Drop Down
Groupie
Groupie


Joined: 13 May 2005
Status: Offline
Points: 87
Post Options Post Options   Thanks (0) Thanks(0)   Quote ramone_johnny Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2005 at 1:49am

dj air - mate, any chance you could provide an exmaple of your method. Also where exactly would I place this bit of code in register.asp?

 
Thank you.
John
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.