Facebook Connect uid MySQL 存储问题
我正在进行 Facebook Connect 集成。我使用 Facebook PHP 库来获取 uid,例如:
$facebook = new Facebook($api_key, $secret); $fb_user = $facebook->require_login();
$fbuser 是一个 16 个字符的长 bigint,例如 1000002949493949
但是,当我将这个值插入 MySQL 时,它只插入 2949493949。
所以后来当我尝试将 uid 与存储在数据库中的 1000002949493949 相匹配时,它不会匹配,因为数据库返回 2949493949。
我的数据库中的 uid 字段是一个长度为 20 的 bigint。它最初是一个 int,但当我开始遇到新的、更长的 uid 时,我改变了它。
知道我需要做什么才能正确存储 uid 吗?
I'm doing a Facebook Connect integration. I use the Facebook PHP library to get the uid, like:
$facebook = new Facebook($api_key, $secret);
$fb_user = $facebook->require_login();
$fbuser is a 16-character long bigint, such as 1000002949493949
However, when I insert this value into MySQL, it only inserts 2949493949.
So later when I try to match the uid to the one stored in my database with 1000002949493949 it doesn't match because the database is returning 2949493949.
The uid field in my database is a bigint with a length of 20. It was originally an int, but I altered it when I started encountering the new, longer uids.
Any idea what I need to do to store the uid correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当将 fb_uid 存储在数据库中时,您应该将其存储为 BIGINT (对于 mysql )
When storing the fb_uid in the db, you should be storing it as a BIGINT ( for mysql )
您还需要确保在 PHP 中使用 64 位整数。您能发布存储信息的 PHP 代码部分吗?
如果您使用 32 位版本的 PHP,我建议尝试将 id 保留为字符串而不是整数。
You need to make sure you're using a 64 bit integer in PHP as well. Can you post the PHP portion of the code that stores the information?
I would suggest trying to keep the id as a string and not an integer if you're using a 32 bit version of PHP.
最简单的方法是将 facebook 的 uid 值存储为 varchar。如果你只需要查询 mysql 数据库来获取 uid 值,那么这是最简单的方法。
the easiest way out would be to store the uid values from facebook as a varchar. if u only have to query the mysql db to get the uid value, then this is the easiest way out.