PHP:
if(strcasecmp($refId, 'guest') == 0)
{
if(strcasecmp( $amount, '24.95' ) == 0)
{
$credits = 20;
$plan = 'cool';
}
if(strcasecmp( $amount, '45.95' ) == 0)
{
$credits = 40;
$plan = 'awesome';
}
if(strcasecmp( $amount, '69.95' ) == 0)
{
$credits = 60;
$plan = 'Supreme';
}
$keyy = generate_key_string();
$query = $pdo->prepare("INSERT INTO keys (keys_key, keys_plan, keys_credit) VALUES (?, ?, ?)");
$query->bindValue(1, $keyy);
$query->bindValue(2, $plan);
$query->bindValue(3, $credits);
if(!$query->execute())
{
echo 'failed' . '<br/>';
echo $plan . '<br/>';
echo $keyy . '<br/>';
echo $credits;
}
}
SQL表:
CREATE TABLE `keys` (
`keys_key` varchar(29) NOT NULL,
`keys_credits` int(11) NOT NULL,
`keys_plan` varchar(255) NOT NULL,
PRIMARY KEY (`keys_key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
我知道值在那里,因为那是我的输出
failed
cool
CDGSI-DUEXP-M9BUZ-4VMQA-YSLIU
20
该查询似乎不适用于此插入,我在其他页面上有不同的插入功能,它们工作正常。谢谢