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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:27:55+00:00 2026-05-22T11:27:55+00:00

currently, i retrieve data from database is like that private void getdatafromphp(){ ArrayList<NameValuePair> nameValuePairs

  • 0

currently, i retrieve data from database is like that

private void getdatafromphp(){
    ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
    //http post
    try{
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://10.0.2.2/video.php");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();
        is = entity.getContent();
    }catch(Exception e){
        Log.e("log_tag", "Error in http connection"+e.toString());
    }
       //convert response to string
    try{
        BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
        sb = new StringBuilder();
        sb.append(reader.readLine() + "\n");
        String line="0";
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
        is.close();
        result=sb.toString();
    }catch(Exception e){
         Log.e("log_tag", "Error converting result "+e.toString());
    }
               //paring data
    try{
        jArray = new JSONArray(result);
        JSONObject json_data=null;
        json_data = jArray.getJSONObject(jArray.length()-1);
        url=json_data.getString("VideoUrl");
    }catch(JSONException e1){
    }catch(ParseException e1) {
        e1.printStackTrace();
    }
}

with this php

<?php
mysql_connect("localhost","root","");
mysql_select_db("imammuda");
$sql=mysql_query("select * from Video");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
print(json_encode($output));
mysql_close();
?>

now i want insert data into database. how to do that?

I had found the sql command which is “insert into table (column1, column2) values (‘value1’, ‘value2’)”.

This is insert with constant values which is type in php.

What i want is from java there get input from user then copy this input into php ‘value1’ after that run the php to update the database.

  • 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-22T11:27:56+00:00Added an answer on May 22, 2026 at 11:27 am

    Depending on whether you are using Get or Post

    i will assume GET

    $value = $_GET['value']; // this will retrieve the value from the url and save it in a variable
    
    mysql_connect("localhost","root","");
    
    // escape the value first
    $value = mysql_real_escape_string($value);
    
    
    mysql_select_db("imammuda");
    $result = mysql_query("insert into Video (value) values ('$value')");
    
    ?>
    

    learn more about working with the db here

    UPDATE

    to know the correct request method you can use this.

    $req;
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        $req = $_GET;
    }else {
        $req = $_POST;
    }
    

    now you can use $req as your request variable:

    $value = $req['value'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to retrieve records from the database? Currently we are
I'm currently attempting to retrieve a list of objects from my database using jQuery.
I'm using an AutoCompleteExtender in ASP.NET/C# to retrieve data from my database, along with
I currently successfully use a SQLite database which is populated with data from the
I currently have links w/ class=ajax that I want to retrieve the element with
UPDATE: This is the CFC code that I'm using to retrieve the data. I'm
I want to retrieve a time stamp from a sql database with proper formatting.
I have an app that uses an sqlite database. Currently I have a database
I am currently using NSURLConnection to download some date from a database through a
Currently I use the following code to retrieve the IP address of the local

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.