This topic is locked

Records viewable by everyone until assigned to user

2/18/2008 10:30:38 PM
PHPRunner General questions
C
comlan author

I have a table of authorized users.
I have a table of names and phone numbers of recruits.
Logged in users should be able to go to the name and phone number table and select people to be assigned to them. (maybe by inserting a new function to use the check boxes and writing a routine to assign selected records to them that have not been previously assigned to anyone??)
Once someone has assigned a record to them, it should not be viewable by anyone else.
Any suggestions/help as how to best do this?
Thanks.

J
Jane 2/19/2008

Hi,
you can do the following:

  1. proceed to the Visual Editor tab,
  2. turn on HTML mode, find this line:
    <!-- delete form -->



and add following code just before:

<A onclick="frmAdmin.a.value='update'; frmAdmin.submit(); return false;" href="TableName_list.htm#">Assign</A>


3. proceed to the Events tab and add Before record deleted event.

Here is a sample code:

if(@$_POST["a"]=="delete")

return true;
global $conn;

$strSQL="update Tablename set AssignFieldname=1 where ".$where;

db_exec($strSQL,$conn);

return false;



where AssignFieldname is your actual field name, Tablename is your actual table name.
4. Then edit your SQL query for this table on the Edit SQL query tab.

Here is a sample:

select field1,

field2,

field3

from Tablename

where AssignFieldname=0