I want to creat a selected grid based on project_name that belongs to login_ID of user. The project_name comes from another table, each project_name can appear more then once. How can I do a select of grid based on the current grid?
MySQL:
login
-login_ID
-user
-password
-role
-title
-lastname
-firstname
-landline
-mobile
-email
mapping_login_project
-mapping_ID
-login_ID
-project_ID
plan
-plan_ID
-date
-author
-project_name
-download_description
-download
project
-project_ID
-project_name
Grid->SQL
SELECT
project.project_name,
login.user,
login.role,
login.title,
login.lastname,
login.firstname,
login.landline,
login.mobile,
login.email
FROM
login,
project,
mapping_login_project
WHERE
mapping_login_project.login_ID=login.login_ID AND
mapping_login_project.project_ID=project.project_ID
Events->OnInit
sc_lookup(get_mapping, “SELECT DISTINCT project.project_name FROM project,mapping_login_project,login,plan WHERE user = ‘[param2]’ AND login.login_ID = mapping_login_project.login_ID AND mapping_login_project.project_ID = project.project_ID”);
sc_lookup(get_table, “SELECT
project.project_name,
login.user,
login.role,
login.title,
login.lastname,
login.firstname,
login.landline,
login.mobile,
login.email
FROM
login,
project,
mapping_login_project
WHERE
mapping_login_project.login_ID=login.login_ID AND
mapping_login_project.project_ID=project.project_ID”);
print_r ({get_table}); // I get all entries of Array {get_table}
// firstfor -> is the max number of register you can do a count in table
// secondfor -> is the max number of fields selected
$result = count({get_table});
echo ($result); // I get number 13 what is right
for($i = 0; $i < count({get_table})-1 ; $i++){
for($j=0; $j < 1 ; $j++){
{get_table[$i][$j]};
}
}
print_r ({get_table[$i][0]}); // I get only one project_name, but there should be 13
echo count({get_table[$i][0]}); // I get number 1
if
(empty({get_mapping}))
{
echo “<script> alert(‘Sie sind aktuell auf kein Projekt gebucht! Bitte wenden Sie sich an einen Administrator’); </script>”;
sc_redir(menu);
}
else
{
echo “<script> alert(‘Projekte die Ihnen zugeordnet sind wurden ausgew?hlt’); </script>”;
$werte_gesamt = “”;
foreach({get_mapping} as $werte_a1)
{
foreach($werte_a1 as $werte_a2)
{
$werte_gesamt .= “’”.$werte_a2."’,";
}
}
sc_select_where(add) = “where ??? IN (”.substr($werte_gesamt, 0, strlen($werte_gesamt)-1).")";
}
get_mapping and get_table work, but I can’t get those two Arrays to match in my last line where I have the sc_select_where(add). print_r ({get_table[$i][0]}); returns only 1 (the last) project_name and not all project_name from my selected grid.
Sorry, but so far I can’t solve it myself even though I’ve been working on this little problem for days. Greetings from Germany