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 table:
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;
I know the values are there because that's my output
failed
cool
CDGSI-DUEXP-M9BUZ-4VMQA-YSLIU
20
the query doesn't seem to be working for just this insert, I have different insert functions on other pages and they work fine. Thanks
keys
is reserved keyword you should escape your columns and tables if you use reserved keywords by backticks
like that
INSERT INTO `keys`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.