Results 1 to 6 of 6
Passing username through a form Forum: PHP ForumReplies: 0
How to Decode the data from Database using database handler? Forum: Search Engine Optimization - SEO - ForumReplies: 1
Retrieve Windows username Forum: PHP ForumReplies: 3
11-14-2003, 06:28 PM #1
Getting A Username From A Database
Hello I was just wondering how to get a username to Response.Write(strUserName) . I have it set to open with a name and password from my db/Members.mdb. I just want to know how to make it say in the middle of the HTML code to say Hello (username), Welcome To The Members Section!
11-14-2003, 06:53 PM #2
Hi, welcome to the forums.
Well, if you already have got the username then your best bet would be to add the username into the session object. Lets say your username from the database is rs("username") ,. then -
session("username") = rs("username")
11-20-2003, 02:46 PM #3
Uh.. I think using session objects isn't a good idea unless you really need to
strsql = "SELECT UserName,Password FROM Members"
set rsSecurity = server.createObject("ADODB.Recordset")
if not rsSecurity.eof then
strUserName = rsSecurity("UserName")
strPassword = rsSecurity("Password")
set rsSecurity = nothing
response.write "Hello " & strUserName & ", Welcome To The Members Section!"
11-20-2003, 03:28 PM #4
Um. If someones logging in, it implies they will have a session. There is nothing wrong with session objects, I would have thought they were less server-intense than calling a recordset every time you wished to write a single name.
11-21-2003, 11:06 AM #5
You're right in this case
But then, it's not often that u use a recordset just to call up one record
Anyway, I'm assuming that he's new to scripting and wants to learn. There are always different ways to do things, so let him decide which method suits his needs best
11-21-2003, 02:21 PM #6
Differing styles give more options