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

  • SEARCH
  • Home
  • 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 7761295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:05:59+00:00 2026-06-01T14:05:59+00:00

I have a little problem, I’m making project and I’m sending data from client

  • 0

I have a little problem, I’m making project and I’m sending data from client to server, server sends it to the mysql database.
I have client and admin tabs in client application,
In client tab i type Username and connect to the server, this username is beeing send to the server and server saves is into database in table users.
In admin tab (client application side) i connect to modify some data from database and add new data to the database.
My problem is: step by step
1. I type username, press connect, username string is being send to the server and saved in mysql in table users
2. Next, I go to the admin tab, I want to add some data to be inserted to the mysql (it’s question in string) so I type that question in textField and press add and the problem is that server reads it as a username and insert it to users table not to the questions table.

Here is the code from client where i send username:

String name = client.nameField.getText();
        out = new PrintWriter (os, true); 
        out.println(name);

Here is the code from admin tab where I send data:

DataOutputStream os = new DataOutputStream (socket.getOutputStream()); 

                String name = client.nameField.getText();
                String title = Configuration.titleField.getText();
                String question = Configuration.questionField.getText();
                String answer1 = Configuration.answer1Field.getText();
                out = new PrintWriter (os, true);

                out.println(title);
                out.println(question);
                out.println(answer1);

And here is the code where are recieve data on the server side:

while(RunThread){

            String name;
            name = in.readLine();


           st.execute("INSERT INTO "+db+" .poll_users (name) VALUES ('" + name + "')");

            String title;
            title = in.readLine();
            if(title!=null)
            st.execute("INSERT INTO "+db+" .poll_titles (title) VALUES ('" + title + "')");

            String question;
            question = in.readLine();
            if(question!=null)
            st.execute("INSERT INTO "+db+" .poll_questions (question) VALUES ('" + question + "')");

            String answer1;
            answer1 = in.readLine();
            if(answer1!=null)
            st.execute("INSERT INTO "+db+" .poll_answers (answer) VALUES ('" + answer1 + "')");

How to make it working?
Thanks for any help

  • 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-01T14:06:00+00:00Added an answer on June 1, 2026 at 2:06 pm

    Maybe you should change your client server protocol from relying on the order of the messages to being more explicit? Might make it more robust.

    Maybe you should send lines like this:

     out.println("Name:" + name);
     out.println("Title:" + title);
     out.println("Question" + question);
     out.println("Answer" + answer1);
    

    Then you can receive the fields in any order..

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

Sidebar

Related Questions

I have a little problem, I am building a database from CSV files using
I'm have little problem in retrieving the data from a table here's the code:
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have a little problem with a query. I'm selecting data using the between
i have little problem in using my application application having msaccess database if i
I have a little problem with a navigation I'm making. I want my navigation
I have little problem with printing data like this, I have written script like
I have a little problem. My friend has a database with over 10 tables
I have a little problem. I want to pass two variables from PHP to
I have a little problem with the silverlight data grid. I wrote a little

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.