U
U
Usman Sk2021-12-25 15:21:04
PHP
Usman Sk, 2021-12-25 15:21:04

Doesn't change data in MySQL table to SQL //UPDATE/SET?

The data in the MySQL table does not change on SQL // UPDATE/SET, everything seems to be correct, and perhaps an error in the "id" In any case, I can not find the error. Maybe someone will succeed, I will be grateful

https://vk.com/doc534601824_635777920
https://vk.com/doc534601824_635778215



<?php 


$mysqli = new mysqli('localhost','root','','home');
if(mysqli_connect_errno()){

prinf("Ошибка при подключении к базе MySQL", mysqli_connect_error());
exit();

}

$mysqli->set_charset('utf8');

 

$music = $mysqli->query('SELECT * FROM music');
while($fullmusic = mysqli_fetch_assoc($music)){

echo $fullmusic['name']."<br>".$fullmusic['author']."<br>";

}



//$query = "INSERT INTO movie VALUES(null, 'Безумный Макс', 'Описание фильма безумный Макс', '2015', Now())";
  //$mysqli->query($query);

  //$query = "UPDATE movie SET year = 1990 WHERE id = 3";
  //$mysqli->query($query);

//$music = "DELETE FROM music WHERE id = 1";
//$mysqli->query($music);

$query = "UPDATE music SET author = ЛАаы WHERE id = 1";
$mysqli->query($query);

$mysqli->close();

 ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HomeWork</title>
</head>
<body>
  
<form action = "/" method = "POST">
<input type = "text" name="name" placeholder = "Название группы">
<input type = "text" name="author" placeholder = "Название композиции">
<input type = "submit" value = "отправить">


</form>

</body>
</html>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
Usman Sk, 2021-12-25
@UsmanSk

$query = "UPDATE music SET author = WHERE id = 1"; no (')
$query = "UPDATE music SET author = 'LAay' WHERE id = 1";

F
FanatPHP, 2021-12-25
@FanatPHP

https://qna.habr.com/q/918033#answer_1847841

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question