Creating a unique page for every user using PHP and MYSQL
Solution:
You'll need to add a relationship between todo and user, the best option is a FOREIGN KEY but is optional.
| users | | todo |
|
So, you keep your user id when they login inside a $_SESSION and every time you list or insert things on the todo you use this reference:
{-code-2}
On PHP with {-code-3}:
{-code-4}
On PHP with {-code-5} bind parameters you can do in this way:
$stmt = ${-code-5}->prepare("INSERT INTO todos (user_id, title) VALUES (?, ?)");
$stmt->bind_param("is", $user_id, $title);
$res = $stmt->execute();