This topic is locked
[SOLVED]

 Enter data in another table

10/27/2012 10:31:04 PM
PHPRunner General questions
J
joiresende author

I have three tables, Orders, Approved and Disapproved. I have a page where I have the validation field approved and disapproved. What I need is when I select the field disapproved inserts data into the table and frowned when I select the field approved inserts the data in the table approved.

Is there any way to do this?

Thank you and sorry for my english.

C
cgphp 10/28/2012

What do you mean when you say "select"? Try to reformulate your request.

J
joiresende author 10/28/2012

Would this.

I have a data entry form if I choose approved data will be inserted into the table approved, disapproved if I choose the data will be inserted into the table frowned.

Below is an example of my data entry page.


would look like this:
if the status field is equal approved

global $conn;

$strSQLInsert = "insert approved (Name, email,orders,......)
if the status field is equal disapproved
global $conn;

$strSQLInsert = "insert disapproved (Name, email,orders,......)

C
cgphp 10/28/2012

Enter the following code in the "After record added" event:

global $conn;

if($values['Status'] == 'Approved')

{

$strSQLInsert = "INSERT INTO approved .....";

}

else

{

$strSQLInsert = "INSERT INTO frowned .....";

}
db_exec($strSQLInsert, $conn);