Forum Moderators: coopster

Message Too Old, No Replies

displaying specific related search results from query

user access related by company_id and job_num_id associated

         

aftershock2020

2:41 pm on Dec 20, 2007 (gmt 0)

10+ Year Member



Hey everyone,

I have a solid login and members area/search page. On registration, I associate two fields to both tables in my database, one being the data records table and the other being obviously the user data table.

I need to know two specific tasks here.

1. How to make the user_id and company_id from the registration form echo to show on the user's member page.

(Please tell me that it is as simple as an insert statement and a standard echo.)

2. How to restrict the search page to only search and display data results related between that specific user_id and company_id so that they don't access all of the data listings, just their's.

I am thinking this one is something like this:

query...WHERE 'production.company_id'='user.company_id'

Which would isolate the relation and give me the specifics that I'm looking for without revealing everything, would it not?

This is for a company that wants to display a 'job-in-progress' option for their clients over the web.

Thanks and happy holidays!

eelixduppy

12:27 am on Dec 23, 2007 (gmt 0)



>> 1. How to make the user_id and company_id from the registration form echo to show on the user's member page.

If it is coming from the form you could just echo it out directly:


echo 'User ID: '.$_POST['user_id'];
echo 'Compant ID: '.$_POST['company_id'];

If you are going to need these values in the future maybe you want to use session [php.net] variables and then echo it out that way:


echo 'User ID: '.$_SESSION['user_id'];
echo 'Compant ID: '.$_SESSION['company_id'];

As for your second question, your example query segment looks like it should do what you want it to. Try it out first and see what you get.