Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:21:00+00:00 2026-06-06T04:21:00+00:00

my application may have more then one users on the same phone, and i

  • 0

my application may have more then one users on the same phone, and i want each user to have its own
“ApplicationFriends” mysqlite table.
when the name of the table is only “ApplicationFriends” everything works great.
but when i’m trying to set the table name like this “ApplicationFriends2345” when 2345 is a uniqe user number, i always get an error when trying to run a select query, saying the table isn’t exist.

this is my table creation code:

public DatabaseManager(Context context, String id) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
    DatabaseManager.TABLE_APPLICATION_FRIENDS = TABLE_APPLICATION_FRIENDS_BASE + id;
}

@Override
public void onCreate(SQLiteDatabase db) {
    String CREATE_APPLICATIN_FRIENDS_TABLE = "CREATE TABLE IF NOT EXISTS "
            + TABLE_APPLICATION_FRIENDS + " (" + APPLICATION_FRIENDS_KEY_ID
            + " INTEGER PRIMARY KEY," + APPLICATION_FRIENDS_KEY_NAME
            + " TEXT" + ")";
    String CREATE_CHAT_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_Chat
            + " (" + CHAT_KEY_SENDER_ID + " INTEGER," + CHAT_KEY_MESSAGE
            + " TEXT," + CHAT_KEY_TIME + " DateTime" + ")";

    db.execSQL(CREATE_APPLICATIN_FRIENDS_TABLE);
    db.execSQL(CREATE_CHAT_TABLE);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:21:02+00:00Added an answer on June 6, 2026 at 4:21 am

    You can do it the way you were trying to (with a table for each user). You just have to move the table creation code into a method other than the onCreate in your dbhelkper class, then call it as necessary (when you add a new user).

    public void createFriendTable(String friendID) { 
        String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS " 
                + friendID + " (" + APPLICATION_FRIENDS_KEY_ID 
                + " INTEGER PRIMARY KEY," + APPLICATION_FRIENDS_KEY_NAME 
                + " TEXT" + ")"; 
         db.execSQL(CREATE_FRIEND_TABLE); 
    } 
    

    Then wherever you need it:

    mDbHelper.createFriendTable(friendID);
    

    This is what I would do as it would make removing a user much easier. You would just drop their table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The users of my web application may have more than one browser window open
My application may have strings comprised of different alphabets / languages in a single
In my java application, I have some entity, some of them may have the
I have an application that may receive data via various methods and in various
I have this relatively large numerical application code that may run for a few
I have a web application where the first request may take a few seconds
I have a small GTK python application that imports a package (Twisted) that may
How may I get the current running application? I want to check if the
Let's say there's an application which should create its own tables in main database
So I have this web app that in theory may one day become a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.