I am looking for help with the following: I have a mysql table where I hv user name and password etc. I have another mysql table with username and user work hour, user performance rating and number of days worked. As soon as the user login to the site, I want to show the user his work hour till tht date, his performance ratng till that day and total number of days he has worked till tht date. I am using php and mysql, so how to accomplish this? Can some one help me with the code to accomplish this objective. I will really be glad for the help.
i dont know much about php but couldnt you use _post? so when the user logs in(if successful login), use post to store the username and call from that row in the 2nd table? dont ask me how to do this, but if you know php this might work....
I can do this, what do you want, do you want me to do it , need the trainning to done by your self ? pm me
<<on the login page, after you've checked the db to make sure someone with that username and pw exists>> $_SESSION['user'] = $username; PHP: Now include this code on the page you want the stats to display: if (isset($_SESSION['user'])) { $query = mysql_query("SELECT * FROM table2 WHERE username='{$_SESSION['user']}'"); while ($row = mysql_fetch_array($query)) { echo "Hello $row[username] <br />"; echo "Your user work hour (?) is: $row[userworkhour] <br />"; echo "Your user rating is: $row[userrating] <br />"; echo "Your total days worked is: $row[daysworked]"; } } PHP:
SHOwnsYou thanks, this is code what i want to suggest. 1. but i think you should using primary key instead username for security and convenience $_SESSION['userid'] = $id; 2. if (isset($_SESSION['user'])) you can easy using if ($_SESSION['user']) effect will be identity
First you need to make a login system !, This tutorial might help you http://www.phpcollection.com/php-login-system-login-management-and-login-control-tutorial.html After that just record the values of the hour worked in mysql and fetch them afterwards to display them ! Hope it helps
@ shownyou and chikey.ru I am confused between both of urs suggestion. @chikey.ru could you please be more specific?