Priviet!
I managed successfully to show two tables in your grid that are 1:n related; The table “staffs” with staff members and the table “Courses” with courses that the staff members have attended.
[code]$sql = “SELECT * from staffs inner join Courses WHERE staffs.ID=Courses.StaffID”;
$res = mysql_query ($sql);
if($res){
while($row=mysql_fetch_array($res)){
//create xml tag for grid’s row
echo ("<row id=’".$row[‘ID’]."’>");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
print("");
}
}else{
//error occurs
echo mysql_errno().": “.mysql_error().” at “.LINE.” line in “.FILE.” file
";
}[/code]
Using the sample code of your php/update.php I am managing to update the left part of the record sets, the fields from the staffs table.
[code]function update_row(){
$sql = “UPDATE staffs SET Type=’”.$_GET[“c0”]."’,
FirstName=’".addslashes($_GET[“c1”])."’,
LastName=’".addslashes($_GET[“c2”])."’,
Phone=’".$_GET[“c3”]."’,
Mobilephone=’".$_GET[“c4”]."’
WHERE ID=".$_GET[“gr_id”];
$res = mysql_query($sql);
return "update";
}[/code]
To update the fields from the course table I have something like this that I can add to function update_row:
$sql2 = "UPDATE Courses SET
Course='".$_GET["c5"]."',
Notes='".$_GET["c6"]."'
WHERE ID=".$_GET["XXXXXXXXXXXXXX"];
$res = mysql_query($sql2);
Now, how do I manage to get the ID from the Courses table into this sql string? I could put the course ID as a read only field into the grid but there must be a better way to handle that… ??
Spaciba,
R