P
P
Profgramer232015-12-27 18:58:56
PHP
Profgramer23, 2015-12-27 18:58:56

A person has registered on the site and needs to be redirected to his profile, how to do this?

Here I have, for example, such a link: mysite.com/profile.php?id= <== This is where the user id should be. In the index.php file I wrote this + profile.php?id="$id_user" but it didn't work. What to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill, 2015-12-27
@synnvkz

header("Location: /profile.php?user_id=" . mysql_insert_id());

mysql_insert_id= id of the last registered user. If you have an id column with a primary key, of course

M
Miku Hatsune, 2015-12-27
@Hatsune-Miku

When registering, find out the ID created for him to rederick:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question