View Attendence

good afternoon:
i am some issue of display the attence for Each user:
 I Have Two Table :
First Table Contains Admin table Which Conatains:
userid
intime
outtime
second Table Contains use table Which Conatains:
id
username
password
role
I Have a landing page where i am displaying userinformfation from usertable and one link is there viewattendence ,if user click then it display userattendence  based on her id
But issue is there that attenence is in admin table(login and logout):then how can i get the attendence beacause in landing page  user passses id not userid:and url search for id which is not there in admin table
For this issue i am using mysql query is:
$sql = "select admins.id, admins.intime, admins.outtime
                                 from admins inner join userregisters  Having  admins.userid='" . $_GET["id"] . "'";

Open in new window

How can i do that plz suggest me
LVL 1
manoj kumarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
You can try this

$userid = isset($_GET['id']) ? $_GET['id'] : false;
if (!$userid) exit();

$sql = <<< QUERY
SELECT 
  `admins`.`id`, 
  `admins`.`intime`,
  `admins`.`outtime`
FROM
  `admins` a LEFT JOIN
   `userregisters` u 
ON 
    a.`userid` = u.`id`
WHERE
    a.`userid` = '{$userid}'
QUERY;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
manoj kumarAuthor Commented:
best solutions  Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.