- Forum posts: 2
Mar 22, 2015, 10:39:17 AM via Website
Mar 22, 2015 10:39:17 AM via Website
I have a sqlite database that the user can register to! I have successfully created a login form and when the login is successful (database's username and password match what the user has entered on the form) the user is redirected to another activity. What i want is in the activity that the user is redirected,
to display his entire database row (id,username, books,email,course, password, student name) based on his username or id!! Any ideas?? I would really appreciate if you could help me..This is urgent!!!
Here is my code for creating the database:
static final String DATABASE_CREATE = "create table "+"LOGIN"+
"( " +"ID"+" integer primary key autoincrement,"+ "USERNAME varchar2," +
"PASSWORD varchar2, COURSE varchar2, EMAIL varchar2, STUDENT_NAME varchar2); ";
Here is the code for storing users to the database:
public void insertEntry(String userName,String password,String course,String email, String student_name)
{
ContentValues newValues = new ContentValues();
// Assign values for each row.
newValues.put("USERNAME", userName);
newValues.put("PASSWORD",password);
newValues.put("COURSE", course);
newValues.put("EMAIL",email);
newValues.put("STUDENT_NAME", student_name);
// Insert the row into your table
db.insert("LOGIN", null, newValues);
///Toast.makeText(context, "Reminder Is Successfully Saved", Toast.LENGTH_LONG).show();
}
and finally here is the login code:
if(password.equals(storedPassword))
{
Toast.makeText(MyActivity.this, "Congrats: Login Successfull", Toast.LENGTH_LONG).show();
dialog.dismiss();
startActivity(new Intent(MyActivity.this, Login_home.class));
}
else
{
Toast.makeText(MyActivity.this, "User Name or Password does not match", Toast.LENGTH_LONG).show();
}
Can you please provide me with the class that does what I'm after??? I've checked everything
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.