HI Everyone
I have two tables with following fields
Table1: ID, Name, Type
Table2: ID_a, Name_a, Address
I want to add the added record in table 2 based on value of Type in Table 1
Now I know I can add event after a new record is added but somehow don;t seems to work. I have looked at
""global $conn;$strSQLInsert = "insert into TableName (Field1, Field2) values (Value1, Value2)";db_exec($strSQLInsert,$conn);""
but not sure how to use this
is this the right way
global $conn;
$strSQLInsert = "insert into Table2 (ID_a, Name_a) values (ID, Name) from Table1 where Type = "company"";
db_exec($strSQLInsert,$conn);
For eg:
Table1: ID = 1
Table1: Name = abc
Table1: Type = company
Now with add record event I want to add this into Table2 as well only where Type matches
I'm getting all sorts of errors from SQL Syntax to Operand columns and MYSql server etc
I'm using Wamp server
Server Configuration
Apache Version :2.2.11 PHP Version :5.2.11
MySQL Version :5.1.36
Can anyone please help me?