Skip to content
Advertisement

Android passing username to php

I am building an android app where the users are expected to perform certain tasks individually assigned to them. To download the project information I am using HTTPServiceClass and passing in a url in my android app. The code is as follows

JavaScript

Inside doInBackground I have the following

JavaScript

I am using PHP and MYSQL. The php code is as follows:

JavaScript

This is working without any problem. However, I want to filter out the project information to specific users by adding a where condition in my select query. How do I pass the app user login information through my getProjects.php. Can I add it as an argument to the getProjectsURL?

Advertisement

Answer

First send user ID to the page as URL parameter as given below

JavaScript

In your PHP code you can get the User ID as given below

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement