Retrofit fetch data from Mysql based on a user inputted string [closed]

风格不统一 提交于 2020-04-30 09:25:50

问题


I am trying to fetch specific columns email from a table using mysql using retrofit using android data. My DB table has the useremail collumn and my ImageList Model Class has the @SerializedName("useremail").

API INTERFACE

public interface ApiInterface2 {
    String BASE_URL = "10.0.2.2/uploadmultiple/";
    @GET("mylist.php")
    Call<List<ImageList>> getImgData(@Query("useremail") String userEmail);}

MAIN CLASS

 ApiInterface2 apiInterface = RetrofitInstance.getRetrofitInstance().create(ApiInterface2.class);
 Call<List<ImageList>> call = apiInterface.getImgData(userEmail);
 call.enqueue(new Callback<List<ImageList>>() {
@Override
           ////////
 });
<?php
include 'dbconfig.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
    $useremail = $_GET["useremail"];
    if(empty($useremail)){echo "UserEmail is null";}
try {

    $email = $_REQUEST["useremail"];
    // Create connection

    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn->prepare("SELECT * FROM `table1` WHERE `useremail` = $email"); 
  ///////
?>


I cant seem to get this right. Please help

来源:https://stackoverflow.com/questions/61460461/retrofit-fetch-data-from-mysql-based-on-a-user-inputted-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!