Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'sessions; sessions_iid()'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. I am new at using PHP and MySQL. I am using a login.php script from Larry's book, and a similiar script I call view_coursegrades.php. I want to be able to identify a teacher who logs into my site, and then use a query based on that identification to allow them to edit and view grades in only the courses where they are the teacher. The following is some of the script: <?php # Script 12.12 - login.php #4 // This page processes the login form submission. // The script now stores HTTP_USER_AGENT value for added security. // Check if the form has been submitted: if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Need two helper files: require ('includes/login_functions.inc.php'); require ('./mysqli_connect.php'); // Check the login: list ($check, $data) = check_login($dbc,$_POST['email'], $_POST['pass']); if ($check) { // OK! // Set the session data: session_start(); $_SESSION['user_id'] = $data['user_id']; $_SESSION['first_name'] = $data['first_name']; // Store the HTTP_USER_AGENT: $_SESSION['agent'] = md5($_SERVER['HTTP_USER_AGENT']); // Redirect: redirect_user('loggedin.php'); } else { // Unsuccessful! // Assign $data to $errors for login_page.inc.php: $errors = $data; } mysqli_close($dbc); // Close the database connection. } // End of the main submit conditional. // Create the page: include ('includes/login_page.inc.php'); ?> ====================================== <?php # Script 10.1 - view_coursegrades.php #3 // This script retrieves the grades for courses. // This version links to edit and delete pages. session_start(); //Access the existing session. echo '<h2>The number below is for teacher ID.</h2>'; echo '<h2>{$_SESSION['user_id']}</h2>'; $page_title = 'View Course Grades.'; include ('includes/header.html'); echo '<h1>Course Grades at ASMWA</h1>'; require ('./mysqli_connect.php'); // Define the query: $q = "SELECT COSID,LastName,FirstName,CourseTitle,TeaLastName, TeacherID, GradeEarned FROM TranscriptView"; $r = @mysqli_query ($dbc, $q); // Count the number of returned rows: $num = mysqli_num_rows($r); =================================== I have been unable to filter the query to select only records from the database where the TeacherID is for the teacher who logged in. Can anyone help me? Wes Smith
×
×
  • Create New...