Home » Php » php – Match session ID to a column with a string to get specific results based on logged user

php – Match session ID to a column with a string to get specific results based on logged user

Posted by: admin February 25, 2020 Leave a comment

Questions:

for example $_session[eid]

select * from results where user = :eid

it should display results related only to the logged in user with reference to the use column
which has names as a string

How to&Answers:

If you want use like variable just start like:

session_start();
$eid=$_SESSION['eid'];
$query=$mysqli->prepare("select * from results where user = ?");
$query->bind_param('i',$eid);
execute ecc ecc......