0
當截斷我有以下查詢:數據條目的MySQL使用%C3特殊字符
INSERT INTO `poll` (`pollId`, `groupId`, `creatorUserId`, `createdDateTime`,
`lastVoteDateTime`, `pollQuestion`, `pollOption`)
VALUES (NULL, '24', '73', '2014-02-18 21:27:12', '0000-00-00 00:00:00',
'1111111111', '222222222222Ã223442')
當使用PHP爲POLLOPTION插入數據截斷這樣222222222222而不Ã223442執行這個查詢;
但是,當在myManager中執行它時,pollOption的數據成功插入「222222222222Ã223442」;
注意: 數據庫和表和字段都是UTF-8。 PHP文件是ANSI編碼
PHP代碼:
date_default_timezone_set('Asia/Calcutta');
require_once "config.php";
error_reporting(0);
$date=date("Y-m-d H:i:s");
$response="";
if(isset($_REQUEST['userId']))
{
$userId=$_REQUEST['userId'];
$groupId=$_REQUEST['groupId'];
$pollQuestion=$_REQUEST['pollQuestion'];
$pollOptions=rawurldecode(htmlspecialchars($_REQUEST['pollOptions']));
$insertPoll=mysql_query("INSERT INTO `poll`
(`pollId`, `groupId`, `creatorUserId`,
`createdDateTime`, `lastVoteDateTime`, `pollQuestion`, `pollOption`)
VALUES (NULL, '$groupId', '$userId', '$date', '0000-00-00 00:00:00',
'$pollQuestion', '$pollOptions')") or die(mysql_error());
echo("INSERT INTO `poll`
(`pollId`, `groupId`, `creatorUserId`, `createdDateTime`,
`lastVoteDateTime`, `pollQuestion`, `pollOption`)
VALUES (NULL, '$groupId', '$userId', '$date', '0000-00-00 00:00:00',
$pollQuestion', '$pollOptions')");
if($insertPoll)
{
$response.='{"success":"0","message":"successfully poll posted"}';
}else
{
$response.='{"success":"1","message":"something went wrong"}';
}
echo $response;
}