PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am developing an app to allow parents to access their children's academic reports online. I previously did this in asp.net and used the pupil id no. as the session variable to limit all the subsequent recordsets to show data only for that pupil. Can anyone advise on how I can do this in PHP? The pupil id is seffectively the password, and I want the to carry to the next pages to use in the MySQL queries on those pages. Can I do this or is there a better method? I want to keep security high as I don't want parents to see the wrong reports !
//must be called at the top of every page you want to use session information on
session_start();
//store student's id
$_SESSION['student_id'] = $student_id;
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Great, thanks for that. however when i try to call the variable in a MySql query ("SELECT pupilID, UPN, forename, surname FROM pupils WHERE UPN = $_session['UPN']";) I get a bad syntax message for near ['UPN']. UPN is the pupilid number i am using in this case and i have set the variable as you suggested.
mysql_query("SELECT pupilID, UPN, forename, surname FROM pupils WHERE UPN = '" . $_SESSION['UPN'] . "'");
However, PHP is case sensitive. Meaning that $_session['upn'] is not the same as $_SESSION['UPN']. $_SESSION must always be capitalized.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.