K
K
Kactus2020-05-03 21:26:42
PHP
Kactus, 2020-05-03 21:26:42

How to make it so that with each request id was added?

The bottom line is that there is a main.php and a button on the site, by entering data and clicking on the button, he accesses action.php on a post request. action.php sends it all to the database. I made it take the last id from the database, add one to it and send it all back, but it sends everything only once by adding it until I refresh the page, if I update it, it adds it again.

$idgamesql = "SELECT id FROM kot_games ORDER BY id DESC LIMIT 1";
$idgame += mysql_query($idgamesql);
This is the action.php code.
I want every request sent to action.php to be entered into the database with a new id.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2020-05-03
@Kactus

Id autoincrement and do not specify it when adding a record

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question