Answer the question
In order to leave comments, you need to log in
Changing an entry in a MySQl database in PHP?
Hello, tell me what's the catch, when you click on the link , it <a href="./archive?id=4">опубликовать</a>
ignores the expression
if (isset($_GET['id']) && $_GET['id'] != '') {
require_once './connect_db.php';
$mysqli_table = 'journal_article';
$sql = "UPDATE ".$mysqli_table." SET `status`= '1' WHERE `id` = '".$_GET['id']."'";
$result = mysqli_query($db, $sql);
}
Answer the question
In order to leave comments, you need to log in
Try changing the if yourself:if (isset($_GET['id']) && ($_GET['id'] != ''))
There is an obvious error here:
You need this:if (isset($_GET['id']) && $_GET['id'] != '') {
$result = mysqli_query($db, $sql);
php.net/manual/en/mysqli.query.php
sql code should be in the first parameter. read the function's documentation before using it.
read about sql injection and filtering incoming data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question