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 7589737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:14:05+00:00 2026-05-30T20:14:05+00:00

I am trying to post a game high-score to my database table, but I

  • 0

I am trying to post a game high-score to my database table, but I cannot figure out how to do this by passing an integer value, only strings. The following is the method I want to call when the game ends, this should insert the score into the score column of my table.

    public void postData() {


    // Create a new HttpClient and Post Header
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://deucalion0.co.uk/insert.php");

    try {
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
        nameValuePairs.add(new BasicNameValuePair("score", finalscore));    //"score" is the name of the database table, finalscore is the integer that contains the value
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);

    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
    } catch (IOException e) {
        // TODO Auto-generated catch block
    }
} 

I am getting a red line under the parameters “score”, finalscore as it tells me it can only take a string, and it knows that final score is an integer.

If I can figure this out, I will then create a way where the user can enter a name via a form input and this will be entered into the user column of the table along with the score. I have searched through Stackoverflow for help with integers and nameValuePairs but could not find anything.

I appreciate any assistance.

Thanks.

  • 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-05-30T20:14:06+00:00Added an answer on May 30, 2026 at 8:14 pm

    URL-encoded forms are text. You will necessarily have to convert your integer scores into text and parse them back into integers on the server side. Alternately, you can devise some kind if binary file for game state data and POST that, but that’s serious overkill if you just want a name and a score.

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

Sidebar

Related Questions

I need some help sorting my score value's of my sql database <table border
This is my first post at this section (XNA and game development). I'm trying
I'm trying to POST a http request using ajax, but getting a response from
first time trying XNA Framework in C#.. followed this tutorial: http://www.uxmagic.com/blog/post/2010/08/17/e2809cHello-Worlde2809d-for-XNA-Game-Studio-40.aspx Everything's ok until
I'm trying to save a logged in user's score to my sql database. I
Revised (clarified question) I've spent a few days already trying to figure out how
I'm trying to create a simple game, but I can't find a certain memory
I'm not sure if I've even labelled this question properly. But what I'm trying
I'm working on an kind of an RPG game. And I'm trying to figure
this is my first post to stack overflow! I'm using SlimDX for a game

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.