エラー: '注文'(ユーザーID、金額、ステータス)値( '76561198206292985'、 '1'、 'open')に挿入してください あなたのSQL構文のエラー。 MariaDBサーバーのバージョンに対応したマニュアルを参照して、正しい構文で1行目( '76561198206292985'、 '1'、 'open')の近くの 'order'を使用してください。SQL構文にエラーがあります。適切な構文を使用するMariaDBサーバーのバージョンに対応するマニュアルを確認してください
私は
<form action="order.php" method="POST">
<select name="amount">
<option value="1">1$ Steam Wallet (10000 Balance)</option>
<option value="2">2$ Steam Wallet (20000 Balance)</option>
<option value="5">5$ Steam Wallet (50000 Balance)</option>
<option value="10">10$ Steam Wallet (100000 Balance)</option>
</select>
<input type="hidden" name="steamid4" value="<?php echo $_SESSION['steamid']; ?>">
<input type="submit" class="btn btn-default" name="submit" style="margin-top:10px" value="Submit" />
</form>
<?php
unset($_SESSION['cmsg']);
if(isset($_POST['submit'])) {
$amount = $_POST['amount'];
$steamid = $_POST['steamid4'];
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT into order (userid, amount, status) values ('$steamid','$amount','open')";
#echo $sql;
if ($conn->query($sql) === TRUE) {
$_SESSION['cmsg'] = '<div class="alert alert-success" role="alert"><i class="fa fa-check"></i> Your order in proccess. We will give the code as soon as possible.<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>';
header('location: order.php');
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
'order'は予約済みのキーワードです。 MSSQLを使用している場合は[] - [order]でラッピングしてください。 –