This topic is locked

Update Multiple Tables

12/7/2011 3:43:21 PM
PHPRunner General questions
T
Tempus_Erus author

HI,
Firstly apologies as there appears to be much written about 'updating tables' - none of which I have been able to successfully use. No doubt I have overlooked the obvious - however here goes with a detailed explanation.....
I have a Master Table "Master Table". There are fields 1,2,3,4 and 5. (in reality I have several tables)
I have another table. We will call "Table 2". There are fields a,b,c,d,e.
I have created a link in the table link properties between both tables ID.(Key Column).
In the query designer - selcting the "Master Table" - I have inner joined this to "Table 2". Click the results tab and all is well - I can see 1,2,3,4,5 and a,b,c,d,e joined as you would expect.
Proceeding to the Edit part of the program I have the field from these two tables in there own tabs. So tab 1 would be Master Table and Tab 2 would be Table 2 with the relevant fields.
Now the problem.
I select table 2 wish to update a coupkle of fields. Press save and I get Unknown column in field list error.
I have used various codes in the before record updated in the relevant table to be updated (ie not in the master table) such as:
global $conn;
$sql = "update table2 set field1=".$values["field1"]." where table2ID".$values["table2ID"];

db_exec($sql,$conn);

unset($values["field1"]);

return true;

I have also tried using DAL also with no success.
Any help in trying to reolve would be appreciated.
thanks in advance.

T
TangoDog 12/7/2011

Just a quick note, but should this [b]$sql = "update table2 set field1=".$values["field1"]." where table2ID".$values["table2ID"];[/b] be "where table2ID = ".

T
Tempus_Erus author 12/10/2011



Just a quick note, but should this [b]$sql = "update table2 set field1=".$values["field1"]." where table2ID".$values["table2ID"];[/b] be "where table2ID = ".


Thanks TangoDog. Original code is correct - double checked though! Still no joy <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=62987&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />