OK this is going to be a complicated question: - I could do it php so it must be easy in php runner I just don't know the right sintaxt.
I am making a data base where there is a number of employees in different departments. Each department has a number of things they need to do at regular intervals(get there site tested, take training)
What I need to is every time a new employee is added I need to look up what different things someone in thier department may need to do and add those as rows to another table.
This is really long and does not work but should give you an idea of what I am trying to do
global $conn;
$query = "SELECT * FROM `mng_cal_items` WHERE `department`='".$values["depart"]."'";
echo $query;
$result=mysql_query($query);
while($record=mysql_fetch_assoc($result)){
foreach($record as $key=>$file){
if ($key="category"){
$category=$file
}
else if ($key="item"){
$item=$file
}
else if ($key="interval_months"){
$interval_months=$file
}
}
global $conn,$strTableName;
$strSQLSave = "INSERT INTO `airhypen_cats`.user_cal_items
(`user_access_id`, `status`, `department`,
`employee_no`, `username_lu`, `category_lu`,
`item_lu`, `interval_months_lu` )
SELECT `id`, `status`, `depart`,
`employee_no`, `user_name`, `".$category."`,
`".$item."`, `".$interval."`
FROM ".$strTableName." WHERE `id`=".$keys["id"]."";
db_exec($strSQLSave,$conn);
}
return true;