Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $con = mysqli_connect("localhost" , "root" , "pass" , "databasename");
- $name = $_POST["Name"];
- $email = $_POST["Email"];
- $username = $_POST["Username"];
- $password = $_POST["Password"];
- $insertquery = mysqli_prepare($con , "INSERT INTO contacts ( Name ,Email,Username,Password) VALUES (?,?,?,?)");
- mysqli_stmt_bind_param($insertquery , "ssss" , $name , $email , $username , $password);
- mysqli_stmt_execute($insertquery);
- mysqli_stmt_close($insertquery);
- mysqli_close($con);?>
- public class ServerRequests {
- ProgressDialog progressDialog;
- public static final int CONNECTION_TIMEOUT = 15000;
- public static final String SERVER_ADDRESS = "http://10.0.2.2/";
- /*
- Some code here
- */
- HttpParams httpRequestParams = new BasicHttpParams();
- HttpConnectionParams.setConnectionTimeout(httpRequestParams , CONNECTION_TIMEOUT);
- HttpConnectionParams.setSoTimeout(httpRequestParams , CONNECTION_TIMEOUT);
- HttpClient client = new DefaultHttpClient(httpRequestParams);
- HttpPost post = new HttpPost(SERVER_ADDRESS + "Register.php");
- /*HttpPost post = new HttpPost("http://10.0.2.2/Sites/phpmyadmin/Register.php");*/
- try {
- post.setEntity(new UrlEncodedFormEntity(data_to_send));
- client.execute(post);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- return null;
- }
- @Override
- protected void onPostExecute(Void aVoid) {
- progressDialog.dismiss();
- callback.done(null);
- super.onPostExecute(aVoid);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement