I have in table several Admins... but every of them can add own customer in table client
I was use command beforeSave() to save on one field of table client Admin UserName...
now I need to make valuelist for Admin, but with only that client name who have in filed saved Admin UserName ...
I was use next:
- Code: Select all
function valuelist__Majstor(){
static $majstor = -1;
if ( !is_array($majstor) ){
$majstor = array();
$rest = mysql_query("select ID, ImePrezime from majstori", df_db());
if ( !$rest ) throw new Exception(mysql_error(df_db()));
while ($rowt = mysql_fetch_row($rest) ) $majstor[$rowt[0]] = $rowt[1];
}
return $majstor;
}
But in this case Admin can see every ImePrezime from every Admin... That is NOT goal...
I need something like...
- Code: Select all
function valuelist__Majstor(){
static $majstor = -1;
if ( !is_array($majstor) ){
$majstor = array();
$rest = mysql_query("select ID, ImePrezime from majstori", df_db());
$AdminName =mysql_query("select ID,AdminName from majstori", df_db());
if ( !$rest ) throw new Exception(mysql_error(df_db()));
while ($rowt = mysql_fetch_row($rest) and $AdminName = $user->val('UserName') ) $majstor[$rowt[0]] = $rowt[1];
}
return $majstor;
}
But this wont work....
help?