简体   繁体   English

当我使用android retrofit2将uuid发布(发送)到服务器时,我得到了不同的号码

[英]I am getting different number when I post (send) uuid to the server using android retrofit2

When I send UUID with android retrofit using post and store it to MySQL database I am getting different value, it is shorten and converted to numbers. 当我使用post发送带有android改造的UUID并将其存储到MySQL数据库时,我得到了不同的值,它被缩短并转换为数字。 Is there anything I have to do when I receive the UUID in PHP or when I store it to MySQL database table? 当我在PHP中收到UUID或将其存储到MySQL数据库表时,有什么要做的事情吗?

This is the UUID generated in my android application: 这是在我的Android应用程序中生成的UUID:

7cbb95ec-2de6-42a4-bd54-5a18b392ca03 7cbb95ec-2de6-42a4-bd54-5a18b392ca03

and when it is stored into the user table it become like this numbers: 当将其存储到用户表中时,它将变成以下数字:

795-26-424-54-51839203 795-26-424-54-51839203

Please can someone explain why this happening and how to fix? 请有人可以解释为什么会这样以及如何解决?

Api interface api界面

@FormUrlEncoded
@POST("insertdata.php")
Call<ResponseBody>insertdata(
    @Field("userid")String userid,
    @Field("articleid")int articleid);

Php insertdata.php PHP insertdata.php

if (isset($_POST['userid'])) {
    $userid = filter_input(INPUT_POST, 'userid', FILTER_SANITIZE_NUMBER_INT);
} else {
    die();
}

It's not a numerical value, so don't filter it like it is. 它不是数字值,所以请不要像这样对它进行过滤。 You're deleting the non-numerical characters. 您正在删除非数字字符。 Don't filter_input , just leave it alone. 不要filter_input ,就别filter_input

For SQL injection issues, as always, use prepared statements with placeholder values . 与往常一样,对于SQL注入问题,请使用带有占位符value的准备好的语句

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在 Retrofit2 按 id 删除数据时出现 IllegalArgumentException 错误? 以及如何修复它? - Why am I getting IllegalArgumentException error while deleting data by id by Retrofit2? And how to fix it? 如何使用 Retrofit2 Android 将音频 (Mp3) 上传到服务器 - How to upload Audio (Mp3) to Server Using Retrofit2 Android 我正在使用jQuery发布php文件,我正在获取500个内部服务器文件,为什么? - I am using jQuery to post a php file, I am getting 500 internal server file, Why? 使用Android中的Retrofit2库进行文件上传 - File Uploading using Retrofit2 library in Android 当我在android中发送发布请求时,它什么也不返回。 当我向服务器发送发布请求时,它会显示写的东西 - When I send a post request in android it return nothing. When I send post request to my server it displays the write thing 当我尝试从服务器发送邮件时遇到致命错误? - when i am trying to send mail from server getting fatal error? smsGateway.Me我想使用API​​发送短信时遇到此错误 - smsGateway.Me I AM GETTING THIS ERROR WHEN I WANT TO SEND SMS USING API 当我尝试使用 phpmailer 发送邮件时,出现错误 - When i tried to send mail using phpmailer, i am getting error 使用axios发出发布请求时,为什么会出现500服务器错误? - Why am I getting 500 server error when making post request with axios? 为什么我尝试删除帖子时出现此错误? - Why am i getting this error when i try to delete a post?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM