Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void registerUser(){
- StringRequest stringRequest = new StringRequest(Request.Method.POST,
- URL_LOGIN,
- new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- Toast.makeText(MainActivity.this,response,Toast.LENGTH_LONG).show();
- }
- },
- new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- Toast.makeText(MainActivity.this,error.toString(),Toast.LENGTH_LONG).show();
- }
- }){
- @Override
- protected Map<String,String> getParams()throws AuthFailureError{
- Map<String,String> params = new HashMap<String, String>();
- Cursor cursor=db.rawQuery(selectQuery,null);
- if (cursor.moveToFirst()) {
- do {
- //params.put("sid",cursor.getString(1));
- params.put("code",cursor.getString(2));
- params.put("answer", cursor.getString(3));
- } while (cursor.moveToNext());
- }
- return params;
- }
- };
- RequestQueue requestQueue = Volley.newRequestQueue(this);
- requestQueue.add(stringRequest);
- }
- $answer = $_POST['answer'];
- $code = $_POST['code'];
- //$sid=$_POST['sid'];
- //$useremail = $_POST['email'];
- //$userpassword = $_POST['password'];
- $user = "root";
- $pass = "";
- $host= "localhost";
- $dbname="offlinesurvey";
- date_default_timezone_set('UTC');
- $date = date('YmdHis');
- //$name=$sid.'_'.$date;
- $con = mysqli_connect($host,$user,$pass,$dbname);
- $sql_create="CREATE TABLE `offlinesurvey`.`lime_survey_` ( `id` INT NULL AUTO_INCREMENT ,whenadded DATETIME, `code` VARCHAR(255) NOT NULL,`answer` VARCHAR(255) NOT NULL , UNIQUE `id` (`id`)) ENGINE = MyISAM;";
- if(mysqli_query($con,$sql_create)){
- }
- else {
- "No..No";
- }
- $sql="insert into lime_survey_(whenadded,code,answer)
- (Now(),'".$code."','".$answer."');";
- if(mysqli_query($con,$sql)){
- echo "data inserted";
- }else{
- echo "Failed";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement