//я бы на вашем месте попробовал вот так для начала
require('connect.php');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$countUsersQuery = 'SELECT count(id) as count_users FROM users WHERE username=?';
$query = $conn->prepare($countUsersQuery);
$query->execute([$username]);
$countUsersResult = $query->fetch();
if ((int)$countUsersResult['count_users'] === 0) {
$insertUserQuery = "
INSERT INTO users (`username`, `password`, `email`)
VALUES ('$username', '$password', '$email')";
} else {
echo "<script>alert('Логин уже занят')</script>";
}
if ($conn->query($insertUserQuery) === true) {
header("Location: /");
} else {
echo "Error: " . $insertUserQuery . "<br>" . $conn->error;
}
$conn->close();
}
$order->numb_type[$key] = $value;
$key
?$order->numb_type = $value;
? $query = 'SELECT * FROM bonusesstat WHERE dateo BETWEEN ? AND ?';
$execParams[] = $firstDate;
$execParams[] = $lastDate;
R::exec($query, $execParam);
SELECT * FROM table
WHERE id IN (SELECT id FROM table where status = 1 limit 50)
for update skip locked
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
INSERT INTO `post` (`name`) VALUES ('gvhj') WHERE ...