Re: [PHP] sharing records with assigned users
Ave, Hey thanks a lot. I'm reading up on those. I appreciate this. Thanks. On 8/26/04 10:07 PM, David Bevan [EMAIL PROTECTED] wrote: On Thu, 2004-08-26 at 13:49, PHP Junkie wrote: Ave, Jay.. Firstly thanks a lot for the tips. I appreciate that and in fact I do try to go methodically in most cases, even using the pen paper to create my flow charts and diagrams of what I'm about to program. I actually love that method of designing an application. In fact, for this Phonebook application as well, right here in front of me is the piece of paper in which I've tried to draw the different modules, their behaviors and the functions which I will need to create in order to make this application work intelligibly. Coming back again to my problem.. If, in the table I'm storing my records, I create a field which stores the Users allowed access to that particular record, then in case of multiple users, that single field will hold multiple user names... Which is a problem for me. And I might be applying a very wrong approach, logically, which is why I came forward for some assistance. Thanks again. On 8/26/04 1:37 PM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] There is one feature that Admin gets which I'm trying to figure out. When the Admin is adding a record, he gets to decide which users he wants to share the record with. He can choose particular Users by clicking on their name to share that record with. How do I make that happen? Any suggestions? [/snip] I am going to go a little sideways in response to your question because I believe that we should help people to learn and improve. Many people enter the PHP arena and become exposed to the shear power available to them, so they want to accomplish more and more complex apps than they would in the course of normal web site interaction. I believe at this point one makes the leap from web developer to applications developer. One of the first things an applications developer should learn is how to design an application before they write the first line of code. This requires things like flowcharting and UML. Every programming language book has several words on this. So, Junkie, what you should do is break down the the componenets into statements. The statements can then be broken down some more...into processes, decisions, etc. Once done you will know what the code is. It's very zen. 1. Admin adds record. 2. Admin chooses user type(s) that will be allowed access to record. 3. Admin saves information so that application knows. NAME ACCESS_LEVEL bhoover admin pnosehair user etc. [/off soapbox] Very much to what Jay mentioned above, you have to take the time to design, although you may have the logic thought out, you need to look at the way you want to interact with the data and the problems it seems to be presenting to you. An app like you are writing is very straight forward IF you have the data structured properly. aside I used to give a project very similar to this to my students when I used to teach programming and logic and all of my students had the same problem/aside I would advise you to read up on normalization particularly second and third normal forms and that should clear up your difficulties. Have a quick read of: http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html to start. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sharing records with assigned users
Ave, Thanks a ton... And this is exactly what I figured I need to do. Someone else also wrote in something similar which prompted me to go in this direction. It's working out now by creating an additional table that maps the users records through ID and holds information on who is allowed access. Thanks again. On 8/26/04 6:11 PM, Torsten Roehr [EMAIL PROTECTED] wrote: I guess you need to create a table that maps users to records with two columns $userID and $recordID. Then you look up in that table if the user is allowed to edit/see this record. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sharing records with assigned users
[snip] There is one feature that Admin gets which I'm trying to figure out. When the Admin is adding a record, he gets to decide which users he wants to share the record with. He can choose particular Users by clicking on their name to share that record with. How do I make that happen? Any suggestions? [/snip] I am going to go a little sideways in response to your question because I believe that we should help people to learn and improve. Many people enter the PHP arena and become exposed to the shear power available to them, so they want to accomplish more and more complex apps than they would in the course of normal web site interaction. I believe at this point one makes the leap from web developer to applications developer. One of the first things an applications developer should learn is how to design an application before they write the first line of code. This requires things like flowcharting and UML. Every programming language book has several words on this. So, Junkie, what you should do is break down the the componenets into statements. The statements can then be broken down some more...into processes, decisions, etc. Once done you will know what the code is. It's very zen. 1. Admin adds record. 2. Admin chooses user type(s) that will be allowed access to record. 3. Admin saves information so that application knows. NAME ACCESS_LEVEL bhoover admin pnosehair user etc. [/off soapbox] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sharing records with assigned users
Ave, Jay.. Firstly thanks a lot for the tips. I appreciate that and in fact I do try to go methodically in most cases, even using the pen paper to create my flow charts and diagrams of what I'm about to program. I actually love that method of designing an application. In fact, for this Phonebook application as well, right here in front of me is the piece of paper in which I've tried to draw the different modules, their behaviors and the functions which I will need to create in order to make this application work intelligibly. Coming back again to my problem.. If, in the table I'm storing my records, I create a field which stores the Users allowed access to that particular record, then in case of multiple users, that single field will hold multiple user names... Which is a problem for me. And I might be applying a very wrong approach, logically, which is why I came forward for some assistance. Thanks again. On 8/26/04 1:37 PM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] There is one feature that Admin gets which I'm trying to figure out. When the Admin is adding a record, he gets to decide which users he wants to share the record with. He can choose particular Users by clicking on their name to share that record with. How do I make that happen? Any suggestions? [/snip] I am going to go a little sideways in response to your question because I believe that we should help people to learn and improve. Many people enter the PHP arena and become exposed to the shear power available to them, so they want to accomplish more and more complex apps than they would in the course of normal web site interaction. I believe at this point one makes the leap from web developer to applications developer. One of the first things an applications developer should learn is how to design an application before they write the first line of code. This requires things like flowcharting and UML. Every programming language book has several words on this. So, Junkie, what you should do is break down the the componenets into statements. The statements can then be broken down some more...into processes, decisions, etc. Once done you will know what the code is. It's very zen. 1. Admin adds record. 2. Admin chooses user type(s) that will be allowed access to record. 3. Admin saves information so that application knows. NAME ACCESS_LEVEL bhoover admin pnosehair user etc. [/off soapbox] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sharing records with assigned users
[snip] If, in the table I'm storing my records, I create a field which stores the Users allowed access to that particular record, then in case of multiple users, that single field will hold multiple user names... Which is a problem for me. And I might be applying a very wrong approach, logically, which is why I came forward for some assistance. [/snip] use a column for user levels (you'll only have a few) in the record and then add a column in the user table that designates what level that user is. RECORD TABLE Record IDUserLevels RecordFooadmin, user, read-only USER TABLE User Level Bob user Junkie admin Sue read-only -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sharing records with assigned users
On Friday 27 August 2004 01:49, PHP Junkie wrote: Coming back again to my problem.. If, in the table I'm storing my records, I create a field which stores the Users allowed access to that particular record, then in case of multiple users, that single field will hold multiple user names... Which is a problem for me. And I might be applying a very wrong approach, logically, which is why I came forward for some assistance. You have a new table which has 2 columns: record_id, user_id Then: SELECT user_id FROM new_table WHERE record_id = whatever; -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Cold hands, no gloves. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sharing records with assigned users
Ave, That makes sense... Actually I think I know exactly what you're saying and I think it's gonna work that way. Let me do this. Thanks a ton! On 8/26/04 2:42 PM, Jason Wong [EMAIL PROTECTED] wrote: On Friday 27 August 2004 01:49, PHP Junkie wrote: Coming back again to my problem.. If, in the table I'm storing my records, I create a field which stores the Users allowed access to that particular record, then in case of multiple users, that single field will hold multiple user names... Which is a problem for me. And I might be applying a very wrong approach, logically, which is why I came forward for some assistance. You have a new table which has 2 columns: record_id, user_id Then: SELECT user_id FROM new_table WHERE record_id = whatever; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sharing records with assigned users
Php Junkie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ave, I'm working on a Phonebook Application for my company. Much of it's functions and application are pretty much clear and workable for me. But there's one aspect which I'm trying to figure out. It's a multi-user application where there's 2 kinds of users... Admin User. The User can only view, add, edit, browse through his own records. Each user does get a public private option, wherein the user can make the record either private, so only he can see it, or public which anybody can view. The Admin can do absolutely anything. There is one feature that Admin gets which I'm trying to figure out. When the Admin is adding a record, he gets to decide which users he wants to share the record with. He can choose particular Users by clicking on their name to share that record with. How do I make that happen? Any suggestions? Thanks. I guess you need to create a table that maps users to records with two columns $userID and $recordID. Then you look up in that table if the user is allowed to edit/see this record. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sharing records with assigned users
On Thu, 2004-08-26 at 13:49, PHP Junkie wrote: Ave, Jay.. Firstly thanks a lot for the tips. I appreciate that and in fact I do try to go methodically in most cases, even using the pen paper to create my flow charts and diagrams of what I'm about to program. I actually love that method of designing an application. In fact, for this Phonebook application as well, right here in front of me is the piece of paper in which I've tried to draw the different modules, their behaviors and the functions which I will need to create in order to make this application work intelligibly. Coming back again to my problem.. If, in the table I'm storing my records, I create a field which stores the Users allowed access to that particular record, then in case of multiple users, that single field will hold multiple user names... Which is a problem for me. And I might be applying a very wrong approach, logically, which is why I came forward for some assistance. Thanks again. On 8/26/04 1:37 PM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] There is one feature that Admin gets which I'm trying to figure out. When the Admin is adding a record, he gets to decide which users he wants to share the record with. He can choose particular Users by clicking on their name to share that record with. How do I make that happen? Any suggestions? [/snip] I am going to go a little sideways in response to your question because I believe that we should help people to learn and improve. Many people enter the PHP arena and become exposed to the shear power available to them, so they want to accomplish more and more complex apps than they would in the course of normal web site interaction. I believe at this point one makes the leap from web developer to applications developer. One of the first things an applications developer should learn is how to design an application before they write the first line of code. This requires things like flowcharting and UML. Every programming language book has several words on this. So, Junkie, what you should do is break down the the componenets into statements. The statements can then be broken down some more...into processes, decisions, etc. Once done you will know what the code is. It's very zen. 1. Admin adds record. 2. Admin chooses user type(s) that will be allowed access to record. 3. Admin saves information so that application knows. NAME ACCESS_LEVEL bhoover admin pnosehair user etc. [/off soapbox] Very much to what Jay mentioned above, you have to take the time to design, although you may have the logic thought out, you need to look at the way you want to interact with the data and the problems it seems to be presenting to you. An app like you are writing is very straight forward IF you have the data structured properly. aside I used to give a project very similar to this to my students when I used to teach programming and logic and all of my students had the same problem/aside I would advise you to read up on normalization particularly second and third normal forms and that should clear up your difficulties. Have a quick read of: http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html to start. HTH -- Regards, David GetAnyIdeas Web Design [EMAIL PROTECTED] P. 416.452.9410 F. 416.570.4529 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php