current session user values in mysql
i need the current session user values in mysql pls send me the query
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
venkatesan srinivasanPosted Feb 12, 2015, 7:06 AM
Suraj SahooPosted Feb 12, 2015, 6:09 AM
http://www.sitepoint.com/users-php-sessions-mysql/
http://stackoverflow.com/questions/17075424/get-the-data-of-specific-user-in-php
Accept if helps.
Thanks
venkatesan srinivasanPosted Feb 12, 2015, 5:42 AM
Francis SusaimichaelPosted Feb 12, 2015, 5:35 AM
1. Hope that you can capture the user name from the text box. Then You can store it session like below:
Session["UserName"]= txtUserName.Text;
2. Hope that you are using "label" like control to display the user name.
string strUserName = Convert.ToString(Session["txt"]);
lbl.Text=strUserName;
3.Try the below code to retrieve the info. Here i have used "SQL" based connection object you should substitute "MySQL" based connection objects.
using (SqlConnection con = new SqlConnection("YourConnectionString"))
{
SqlCommand cmd = new SqlCommand(String.Concat("Select no,username,exp1,exp2,exp3,total from YourTableName where username='",strUserName,"'" );
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt= new DataTable();
da.Fill(dt);
}
If you have any clarification, let me know.
venkatesan srinivasanPosted Feb 12, 2015, 5:03 AM
1. i m log in one user name for eg(emp1)
2.i need the session name to display
3. i extract the data from my sql from the current session user
my db fildes (no,username,exp1,exp2,exp3,total)
Francis SusaimichaelPosted Feb 12, 2015, 3:49 AM
venkatesan srinivasanPosted Feb 12, 2015, 2:22 AM
Suraj SahooPosted Feb 12, 2015, 2:01 AM
Please follow the below links.
They will surely help you
http://stackoverflow.com/questions/5818917/is-it-possible-to-a-create-session-variable-in-javascript
http://www.codeproject.com/Articles/633199/Using-MySQL-Session-State-Provider-for-ASP-NET
Thanks
Accept if this helps anyway.