Let's say I have a database with a users table and id name count fields. I made a page in php that displays the following information according to the following scheme: name count button In my case: Olga 0 button Anton 0 button pressing the button changed the count of the person in front of whom the button stands.

  • Show the code that you do not understand. - Vladimir Glinskikh Nov.

2 answers 2

You put a minus for:

  • no code in question: here are not telepaths

  • complete lack of understanding of even the basics of PHP, html and js: it takes only a couple of hours for newbies to understand how it is connected to each other and google documentation, examples or solution pieces

  • meaninglessness of the task you are trying to solve: no one does

  • vague wording: you obviously need to change the counter in the database, but according to your description you might think that just on the page

Just read this:

    A little warm, and created for you this very page:

    $connect = mysqli_connect('localhost', 'user_name', 'user_pass', 'db_name'); $result = mysqli_query($connect, "SELECT `id`, `name`, `count` FROM `users`"); if ($_POST['send']) { mysqli_query($connect, "UPDATE `users` SET `count` = '".$_POST['count']."' WHERE id = '".$_POST['id']."'"); header("Location: /"); } while ($data = mysqli_fetch_assoc($result)) { ?> <form method="POST"> <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> <input type="text" value="<?php echo $data['name']; ?>" disabled> <input type="text" name="count" value="<?php echo $data['count']; ?>"> <input type="submit" name="send"> </form> <?php }