程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

android app connect to mysql with PHP

发布于2023-05-25 21:33     阅读(631)     评论(0)     点赞(26)     收藏(2)


I have no idea of php but the code should be something like this `

$con = mysqli_connect($host_name, $user_name, $user_pass, $db_name);


if($con)
{
$image = $_POST ["image"];
$name = $_POST ["name"];
$sql = "insert into imageinfo(name) values('$name')";
$upload_path = "uploads/$name.jpg";

if(mysqli_query($con,$sql))
{
file_put_contents($upload_path,base64_decode($image));
echo json_encode(array('response'=>'Image Upload Successfully'));
}
else
{
echo json_encode(array('response'=>'Image upload failed1'));
}
}
else
{
echo json_encode(array('response'=>'Image Upload Failed2'));
}
mysqli_close($con);
?>`

I'm getting an error of unidentified objets image and name from ($image = $_POST ["image"]..). If I use if(isset) I get the below response:

Image upload failed2


解决方案


Remove the space

$image = $_POST["image"];
$name = $_POST["name"];


所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接:http://www.phpheidong.com/blog/article/546148/702f72b29f9a2850bb5e/

来源:php黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

26 0
收藏该文
已收藏

评论内容:(最多支持255个字符)