Specifying a column range for sorting data


i have dabase called 'docsecurity' of permissions , categories list of documents stored on server. each document may assigned 1 or more categories , each page has several levels of permissions read edit. categories stored string or null in column 6 through 16 , permissions stored in row 17 through 35. each user on system tied list of permissions , categories user id using same docsecurity table. user 10  may able read qc , qa documents associated marketing , followup category having permissions set read qc , qa may able edit docs in  qa docs in followup category because editing permissions set yes in qa / marketing. of permissions , categories working fine , logic worked out.

 

here's problem. want scan 'docsecurity' table find matches occur. here's i'd in english.

 

from docsecurity table compare categories , permissions docksecurity record 'currentuserid' docsecurity record 'currentdocid' , show every field categories , permissions match.

 

i have query written pull out currentuserid , report row , pull out currentdocid row. it's comparrison i'm having problems with. solution have come huge string of if statements , echos. it's cumbersome , looks this:

 

if ($row_currentuser[6] == $row_currentdoc[6]) {echo '<li>', $row_currentdoc[6], '</li>'; } if ($row_currentuser[7] == $row_currentdoc[6]) {echo '<li>', $row_currentdoc[7], '</li>'; } 

 

i repeat each of rows until end. makes big block of code , documents added list there can additional columns added table. there hundreds of columns of categories. can't going code every time new column added write new if statement echo matches.

 

i'd write this:

foreach($currentuser[6] $key => $val) {   echo "{$key} => {$val}\n"; } 

but have modified comparrison described above.  maybe haven't been able work.

for x = 0 len(row1[])-1

    if row1[x] = row2[x]

        echo value

but haven't been able figure out how put working php code.

>categories stored string or null in column 6 through 16

>and permissions stored in row 17 through 35

 

really!?  why not create separate table these - make life easier. anytime hear request search multiple columns occurance, have believe data not normalized.



More discussions in Develop server-side applications in Dreamweaver


adobe

Comments

Popular posts from this blog

Joomla 3.3 Installation Error message - Joomla! Forum - community, help and support

Multilanguage infinite redirect loop error. - Joomla! Forum - community, help and support

trim media limit reached