This topic is locked
[SOLVED]

 inserting as a list

7/31/2006 10:37:17 AM
PHPRunner General questions
A
amirgulamali author

I have 3 tables, 1 primary (_students) and 2 secondary(_1ee0,_2ee0)
I want to insert values into the primary table (_students) upon updating the secondary tables. I am using events for the secondary tables as:

<?php

function BeforeEdit(&$values, $where)

{
// Parameters:

// $values - Array object.

// Each field on the Edit form represented as 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be edited
//********** Insert a record into another table ************

global $conn;

$strSQLInsert = "insert into _students (Completed) values ('1ee0')";

db_exec($strSQLInsert,$conn);
return true;
// return true if you like to proceed with editing this record

// return false in other case
}
?>


Well, it sure inserts '1ee0' in the primary table but as a new record.
For each student in _students, theres a corresponding entry in the secondary table. I want to insert 1ee0 in the same column corresponding to the student i edit.
Also I have 2ee0 as well, and i want the _students table to record values'1ee0'and '2ee0' upon updating the secondary tables as a list.. like so: 1ee0, 2ee0... what data type should i select using PHPRunner when making the table..

J
Jane 8/1/2006

Amir,
you can select VARCHAR[50] for this field.