For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > March 2005 > Re: [PHP-DB] Working with multiple tables...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Working with multiple tables...
Mark Cain

2005-03-22, 3:56 am

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@sbc.com>
To: <php-db@lists.php.net>
Sent: Monday, March 21, 2005 2:44 PM
Subject: [PHP-DB] 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@sbc.com
> Web: http:\\ldsa.sbcld.sbc.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com