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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:04:40+00:00 2026-06-04T00:04:40+00:00

hey guys i wanna ask a question about sending data to database to server

  • 0

hey guys i wanna ask a question about sending data to database to server using android app i am write script code by php like this .

     <?php 
            $coonect=mysql_connect("myhost of the site ","root","");
         if(!$coonect){
       echo "Data_base error";
         die(mysql_error());
         }
       ?>
       <?php
          $username=$_POST['menu_name'];
               $id=$_POST['id'];

         $db_select=mysql_select_db("TableName");
       if(!$db_select){
            die(mysql_error());
            echo" error";

     }
       $query= "INSERT INTO `DatabaseName`.`TableName` (
                   `name` ,
                    `id`
                        )
               VALUES (
                 '{$username}', '{$id}'
                        ); " ;

                  if($medo=mysql_query($query)){
             header("localhost/filename");
           exit;
               }else{
     echo"<p> Error</p>";
     die(mysql_error());
            }

               ?>

        <?php 
             mysql_close($coonect);
        ?>

and the code in the action buuton in the android like this .

           public void postData() {
// Create a new HttpClient and Post Header
   HttpClient httpclient = new DefaultHttpClient();
   HttpPost httppost = new HttpPost("http://mysite/script.php");

  try {
    // Add your data
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
    nameValuePairs.add(new BasicNameValuePair("menu_name", "any data"));
    nameValuePairs.add(new BasicNameValuePair("id", "0345644"));
    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 dont change any thing in Androidmainfest file to establish the connection do i have to and if i should put something what isit ?!! but the apk work fine but it dosent work at all do i making something wrong in my code or i should put any permission in the Androidmainfest i dont know what’s wrong ??? any Help pleas

  • 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-04T00:04:41+00:00Added an answer on June 4, 2026 at 12:04 am

    As far as I know, any network communication would require this

    <uses-permission android:name="android.permission.INTERNET" />

    in the manifest file. But I can’t really tell if it is due to this prevent you from doing your thing. Maybe after doing adding this, you could do a ping test from your android device using terminal emulator or apps like that. Let me know if you need help getting these information.

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

Sidebar

Related Questions

Hey guys, I have some questions would like to ask: I wanna ask how
Hey guys I am working on android application. My app includes an activity which
Hey guys I have a question. I wanna create a profile page for each
Hey guys here is my question. im using JCombobox. if a student have CB
Hey guys, I wanna ask if there is an IDE to which i can
Hey guys i am currently working on an android app that will allow me
Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Hey guys I have about 8 fieldSets and Im iterating over a list. I
Hey guys I am making a terminal application using Swing and Apache Commons. I
Hey guys i'm using this plugin from Hawkee. Its like twitter where you can

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.