Fatal error: Call to a member function bind_param () on boolean

0

I am creating an android application that communicates with the web service in order to add data to mysql. When executing the code, the application sends some data and expects a response from the server, the server is responsible for saving the images sent from the application on the same server, sending other data to the database and returning a response to the application, but the server only he manages to save the photos on the server and he can not upload the other data to the database and he returns an error response:

  

Fatal error: Call to a member function bind_param () on boolean

this is my server php code:

 <?PHP
    $hostname_localhost="localhost";
    $database_localhost="photogo";
    $username_localhost="root";
    $password_localhost="Root1234";
    $con=mysqli_connect($hostname_localhost,$username_localhost,$password_localhost,$database_localhost);
        $u_name = $_POST["u_name"];
        $localname = $_POST["localname"];
        $zone = $_POST["zone"];
        $category = $_POST["category"];
        $latitude = $_POST["latitude"];
        $logitude = $_POST["longitude"];
        $comment = $_POST["comment"];
        $image = $_POST["image"];
        $date="".date("Y-m-d H:i:s")."";
        $name=$u_name."_".date("d_m_Y_H_i_s").".jpg";


        $path = "images/".$name;
        //$url = "http://$hostname_localhost/ejemploBDRemota/$path";
        $url = "images/".$name;
        file_put_contents($path,base64_decode($image));
        $bytesFiles=file_get_contents($path);
        $sql="INSERT INTO dataimage VALUES(?,?,?,?,?,?,?,?,?,?)";

        $stm=$con->prepare($sql);

        $stm->bind_param('ssssssddss',$bytesFiles,$url,$u_name,$localname,$zone,$category,$latitude,$logitude,$comment,$date);

        if($stm->execute()){
            echo "register";
        }else{
            echo "noRegister";
        }

        mysqli_close($con);
    ?>

My BD:

This is the code for android:

 public void upLoadToWebService(final ProgressBar progressBar, final String username, String Lname, String Zone, String Category,
                                   final Double Latitude, final  Double Longitude, String Comment, String Image) {
        progressBar.setVisibility(View.VISIBLE);
        final Double latitude=Latitude;
        final Double longitude=Longitude;
        final String u_name =username.trim();
        final String localname=Lname.trim();
        final String zone=Zone.trim();
        final String category=Category.trim();
        final String comment=Comment.trim();
        final String image=Image.trim();

        final  String file="/uploadimg/uploadimage.php";
        String url=ip+file;

        strq=new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {
                Log.i("RESPONSE: ",""+response);

                progressBar.setVisibility(View.GONE);

                if (response.trim().equalsIgnoreCase("register")){
                    Toast.makeText(c,"המיקום התווסף בהצלחה", Toast.LENGTH_LONG).show();
                    Intent i =new Intent(c,Principal_Activity.class);
                    startActivity(i);
                    ((Activity)c).finish();
                }else{
                    Toast.makeText(c,"המיקום לא התווסף", Toast.LENGTH_LONG).show();
                }

            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                progressBar.setVisibility(View.GONE);

                Log.i("ERROR",""+error);
                Toast.makeText(c,"יש בעיה עם התקשורת אנא נסה שנית", Toast.LENGTH_LONG).show();

            }
        }){
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {

                Map<String,String> params=new HashMap<>();
                params.put("u_name",u_name);
                params.put("localname",localname);
                params.put("zone",zone);
                params.put("category",category);
                params.put("latitude", String.valueOf(latitude).trim());
                params.put("longitude", String.valueOf(longitude).trim());
                params.put("comment",comment);
                params.put("image",image);
                return params;
            }
        };

        strq.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        Volley.newRequestQueue(c).add(strq);
    }
    
asked by Julio Mizrahi 19.11.2018 в 07:06
source

0 answers