I have problem to insert image in mysql I get the error
Could not enter data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '�' at line 26( the line of the Photo). I already check the convert from byte[] to string is well and reverse to
here is my code :
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
yourSelectedImage.compress(Bitmap.CompressFormat.PNG, 0, outputStream);
photoDB = outputStream.toByteArray();
pass it throw intent
String photo = Base64.encodeToString(getIntent().getByteArrayExtra("photo"), Base64.DEFAULT);
nameValuePairs.add(new BasicNameValuePair("photo", photo));
then Httppost
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse httpResponse = httpClient.execute(httpPost);
String responseBody = EntityUtils.toString(httpResponse.getEntity());
and then PHP script
$photo = $_POST['photo'];
$photo1=base64_decode($photo);
$result = mysql_query("insert into table(..,..,..,Photo)values(..,..,..,'{$photo1}')");