Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to modify a link with an user ID

<a href="https://123.com/'.$_SESSION["usersId"].' " target="_blank"><img src="./images/w.jpg"></a>

Hello, I’m new to coding and I was wondering how can I make a custom link with an user ID directly taken from my database. The name usersId is a column in a mySQL table and I take that usersId from a session. Can you please help me fix the problem

I tried to use a $_SESSION to insert the user id in the link but it seem that it didn’t work and when I open a session on my website it just removes the $_SESSION and give me a link without the user id at the end.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Have you defined your session object?
It should look like this;

$_SESSION["userId"] = your_mysql_object["userId"]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading