Skip navigation
Wookie
Currently Being Moderated

Returning filtered records based on login password

Dec 16, 2010 8:26 AM

Hi,

 

I'm using MySql / PHP / DW

 

 

I have a 'login.php' page which has two fields USERNAME & PASSWORD, and a 'jobs.php' page which displays a list of Client's jobs.

 

I need Client A to log in and only see Client A's jobs and so on for my various clients...

 

I have two tables, USER and JOBS.

 

USER TABLE

client_id (primary key)

username

password

access_level

 

 

JOBS TABLE

job_id (primary key)

client_id

client

site

install_date

 

I need 'jobs.php' to display Client A's jobs based on the username and / or password he has entered.

 

Do I have to create a query in MySql or can I achieve this within DW in recordsets or something? I'm very confused!

 

 

Thanks

 
Replies
  • Currently Being Moderated
    Dec 16, 2010 9:04 AM   in reply to Wookie

    When you check whether the entered username and password values match the ones in the database, retrieve the id of that record and set it to a session variable or a temporary cookie.  Then on the page on which you want to display the Client records create a recordset based on your main table and filter it with the id value in the session variable.  This should do it.

     

    To filter the recordset with the session variable your SQL statement would contain something like this:

     

    $_SESSION["customerid"]

     

    J.S.

    http://www.ultrasuite.com/

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2010 9:04 PM   in reply to Wookie

    I don't know if DW has any such built-in functionality.  I do have extensions which do it but you can hand code it just as easily.

     

    You obtain the id of the last insert by using this:

    SELECT LAST_INSERT_ID();

     

     

    J.S.
    UltraSuite Extensions

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points