$sql = mysqli_query($link, "SELECT * FROM reg WHERE name='$name' LIMIT 1");
if (!mysqli_num_rows($sql)) { // логин не найден
echo 'неверный логин и пароль';
} else { // логин найден
$result = mysqli_fetch_array($sql)
if($result['password'] == $password){ // пароль верный
echo 'логин и пароль верные';
}else{ // пароль не верный
echo 'неверный логин и пароль';
}
}
$stmt = mysqli_prepare($link, "INSERT IGNORE INTO Users (a1, a2, a3, s1, s2) VALUES (?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($stmt, 'sssss', $a1, $a2, $a3, $s1, $s2);
foreach($json['object'] as $item) {
$a1 = $item['a1'];
$a2 = $item['a2'];
$a3 = $item['a3'];
$s1 = $item['s1'];
$s2 = $item['s2'];
mysqli_stmt_execute($stmt);
}
mysqli_stmt_close($stmt);
mysqli_close($link);
-- высший приоритет
INTERVAL
BINARY, COLLATE
!
- (unary minus), ~ (unary bit inversion)
^
*, /, DIV, %, MOD
-, +
<<, >>
&
|
= (comparison), <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN
BETWEEN, CASE, WHEN, THEN, ELSE
NOT
AND, &&
XOR
OR, ||
= (assignment), :=
-- низший приоритет
mysql> SELECT 1+2*3;
-> 7
mysql> SELECT (1+2)*3;
-> 9
`act_dt` > (NOW() - INTERVAL 30 DAY)
`act_dt` > NOW() - INTERVAL 30 DAY
(`act_dt` BETWEEN '12.12.2019' AND '15.15.2019') AND valid='on'
`act_dt` BETWEEN '12.12.2019' AND '15.15.2019' AND valid='on'
SELECT * FROM tbl WHERE user_id=$id
product.id
product.title
product.seller_id
seller.id
seller.name
seller.cat_id
SELECT * FROM product
LEFT JOIN seller ON product.seller_id = seller.id
WHERE seller.cat_id=1
SELECT data_json -> "$.books[*].id" FROM test
e_mail = '$e_mail' phone_number = '$phone_number' region
e_mail = '$e_mail', phone_number = '$phone_number', region
explicit_defaults_for_timestamp is enabled, the server disables the nonstandard behaviors and handles TIMESTAMP columns as follows:
- It is not possible to assign a TIMESTAMP column a value of NULL to set it to the current timestamp. To assign the current timestamp, set the column to CURRENT_TIMESTAMP or a synonym such as NOW().
`dt` timestamp DEFAULT NULL,
`dt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
$myimg = './img/' . basename($_FILES['uploadfile']['name']);
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $myimg)) {
// сохраняем путь в базу
}
DELETE FROM b_iblock_section WHERE IBLOCK_ID=4 LIMIT 100
DELETE FROM b_iblock_section WHERE id IN (
SELECT * FROM (
SELECT ID FROM b_iblock_section WHERE IBLOCK_ID=4 LIMIT 0,100
) as `id`
)
UPDATE table1 t1 JOIN table2 t2 ON t1.id = t2.id
SET t1.col1 = t2.col1, t1.col2 = t2.col2
UPDATE t1 SET col1 = (SELECT col1 FROM t2 WHERE id = t1.t2_id)
session_write_close(); // закрыть сессию
fastcgi_finish_request(); // завершить обработку запроса клиента
.. // тут "долгие" операции
$text = iconv("UTF-8", "UTF-8//IGNORE", $text);
$text = mb_convert_encoding($text, 'UTF-8', 'UTF-8');