Re: Working with multiple tables...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is the nature of the userid?  is it something assigned by one of the
systems?  or is it chosen by the user himself?  or is it a constant such as
am employee ID?

Here's how I would approach it:

query the tables for the occurrence of the userid and obtain the system name
at the same time.

with the results, build a multidimensional associative array with userid and
system name such as

$prior[$row[system_name]][$row[userid]] = "grey";

Then in the code for the page loop though the systems with the userid such
as:

foreach ($prior as $system) {          // This will hit your systems one
after the other
  if ($prior[$system[$userid]]) {       // if this variable exists, it will
test as true
     $color = "grey";
  } else {
     $color = "black";
  };
};


That would be my starting stab at it.  I hope I understand enough of what
you're trying to do and that perhaps you understand what I am trying to do.
Let me know if this needs clarification.

Mark Cain



----- Original Message -----
From: "NIPP, SCOTT V (SBCSI)" <sn4265@xxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Monday, March 21, 2005 2:44 PM
Subject:  Working with multiple tables...


> I am working on revising a web request app that I have already
> developed.  The app basically provides a list of system names with
> checkboxes for a user to select to request accounts on the systems.  One
> feature I am intending to add is that the app should check a separate
> database of user accounts to see if the user already has an account on
> the system.  I think I could get it to work by making a query of the
> userid for each system, but this seems quite inefficient.  I would
> rather somehow have a single query that gets a list of system names and
> also checks the user account database at the same time to determine if
> the user already has an account.  Then I would like to display ALL of
> the systems, but "grey out" the ones that the user already has accounts
> on.  Can someone help me figure out the best way to go about this?
> Thanks in advance.
>
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  sn4265@xxxxxxx
> Web:  http:\\ldsa.sbcld.sbc.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux