CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 insert into multiple tables under postgres and php

Print topic Send  topic

Author Message
kirchaj
Posted: 05/28/2004, 9:50 AM

I am trying to find the easiest way to insert into 2 postgres tables at the same time. When a new student is added to our system, I would like there SSN used to create essentially a blank record in the Admissions table inserting only the ssn from the student. That way when the user pulls up the student admissions recored it will show all blank fields and the user will have to update the record. any help would be greatly appreciated.

Tony
peterr


Posts: 5971
Posted: 05/28/2004, 1:57 PM

Possibly this is what you're looking for:
http://docs.codecharge.com/studio/html/ProgrammingTechn...eCustomSQL.html
In your case you could use the "After Insert" event to add record to the second table.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
kirchaj
Posted: 06/03/2004, 8:39 AM

Peter,

I have tried your suggestion and I am having a little trouble. I am sure it is my lack of knowledge of how CCS works but could you take a look. Here is the code

<?php
//BindEvents Method @1-DA92EBFF
function BindEvents()
{
global $student;
$student->ds->CCSEvents["AfterExecuteInsert"] = "student_ds_AfterExecuteInsert";
}
//End BindEvents Method

//student_ds_AfterExecuteInsert @2-5E318FA4
function student_ds_AfterExecuteInsert()
{
$student_ds_AfterExecuteInsert = true;
//End student_ds_AfterExecuteInsert

//Custom Code @40-84CB5652
// -------------------------
global $student;
// Write your own code here.
$db = clsDBedtechaccount
$SQL = "INSERT INTO admit (ssno, ta1, ta1b, ta2, ta2b, ta3, ta3b, ta4, ta5, ta6, formc, wsa, wsna, hsp, hsf, dp, cert, reads, reade, spells, spelle, langs, lange, maths, mathe, ctbs, ctbsr, ctbsc, gpa, act, eact, eng, math, ss, ns, prxgk, prxgkd, prxcs, prxcsd, ppstm, ppstmd, ppstr, ppstrd, ppstw, ppstwd, cbppstm, cbppstmd, cbppstr, cbppstrd, cbppstw, cbppstwd, sat, satd, grea, gread, grev, grevd, greq, greqd, grec, grecd, cert1a, cert1b, cert1c, cert2, cert3, active, aw, hrs, ca, fc, majorcd, graddate, crimechk, physical, tbchk, notes, codeethic, psclass) ".
"VALUES (" . $db->ToSQL(CCGetFromGet("ssno", 0) . "," . "null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null" . ")";
$db->query($SQL);
$db->close();

}

// -------------------------
//End Custom Code

//Close student_ds_AfterExecuteInsert @2-4060F663
return $student_ds_AfterExecuteInsert;
}
//End Close student_ds_AfterExecuteInsert


?>


I am getting the following error that corresponds to the $SQL= line

Parse error: parse error, unexpected T_VARIABLE in /home/accountability/public_html/student_maint2_events.php on line 21


Thanks for your help.

Tony


Last Hero
Posted: 06/04/2004, 8:18 AM

try add ")" after $db->ToSQL(CCGetFromGet("ssno", 0)

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.