CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 Code Critique

Print topic Send  topic

Author Message
Simon Chee
Posted: 06/17/2002, 4:35 AM


Can some of you expieirenced CCS Coders have a look at this code.

I want to know if there is a better way to do this as my code looks a bit
clunky.

thx in advance

<?php
//BindEvents Method @1-297BE31B
function BindEvents()
{
global $wars;
$wars->CCSEvents["AfterInsert"] = "wars_AfterInsert";
global $wars;
$wars->CCSEvents["BeforeShow"] = "wars_BeforeShow";
global $wars;
$wars->CCSEvents["AfterDelete"] = "wars_AfterDelete";
global $wars;
$wars->CCSEvents["AfterUpdate"] = "wars_AfterUpdate";
}
//End BindEvents Method

function wars_AfterInsert() { //wars_AfterInsert @4-6BE54FF0

//Custom Code @26-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
global $wars,$newwid;
$newwid = mysql_insert_id();
$results_ds = new clsDBLeague();
$sSQL2 = "INSERT INTO results ("
. "sid, "
. "wid, "
. "cid, "
. "score, "
. "pts"
. ") VALUES ( "
. $wars->ds->ToSQL($wars->ds->Season->GetDBValue(),
$wars->ds->Season->DataType) . ", "
. $newwid .","
. $wars->ds->ToSQL($wars->ds->Clan1->GetDBValue(),
$wars->ds->Clan1->DataType) . ", "
. $wars->ds->ToSQL($wars->ds->Rnds1->GetDBValue(),
$wars->ds->Rnds1->DataType) . ", "
. $wars->ds->ToSQL($wars->ds->Pts1->GetValue(),
$wars->ds->Pts1->DataType)
.")";
$sSQL3 = "INSERT INTO results ("
. "sid, "
. "wid, "
. "cid, "
. "Score, "
. "pts"
. ") VALUES ( "
. $wars->ds->ToSQL($wars->ds->Season->GetDBValue(),
$wars->ds->Season->DataType) . ", "
. $newwid .","
. $wars->ds->ToSQL($wars->ds->Clan2->GetDBValue(),
$wars->ds->Clan2->DataType) . ", "
. $wars->ds->ToSQL($wars->ds->Rnds2->GetDBValue(),
$wars->ds->Rnds2->DataType) . ", "
. $wars->ds->ToSQL($wars->ds->Pts2->GetValue(),
$wars->ds->Pts2->DataType)
.")";
$results_ds->query($sSQL2);
$results_ds->query($sSQL3);
//End Custom Code

} //Close wars_AfterInsert @4-FCB6E20C

function wars_BeforeShow() { //wars_BeforeShow @4-205258FD

//Custom Code @27-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
global $wars,$newwid,$results_ds;
$results_ds = new clsDBLeague();
$where = " wid = "
. CCGetFromGet("wid",0)
. " and cid = "
. CCGetFromGet("cid1",0);
$wars->Rnds1->SetValue(CCDLookUp("score","results",$where,$results_ds));
$wars->Pts1->SetValue(CCDLookUp("pts","results",$where,$results_ds));
$where = " wid = "
. CCGetFromGet("wid",0)
. " and cid = "
. CCGetFromGet("cid2",0);
$wars->Rnds2->SetValue(CCDLookUp("score","results",$where,$results_ds));
$wars->Pts2->SetValue(CCDLookUp("pts","results",$where,$results_ds));

//End Custom Code

} //Close wars_BeforeShow @4-FCB6E20C

function wars_AfterDelete() { //wars_AfterDelete @4-31B39D8C

//Custom Code @28-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
global $wars,$newwid,$results_ds;
$results_ds = new clsDBLeague();
$sSQL3 = "delete from results where wid = "
. CCGetFromGet("wid",0);
$results_ds->query($sSQL3);
//End Custom Code

} //Close wars_AfterDelete @4-FCB6E20C

function wars_AfterUpdate() { //wars_AfterUpdate @4-162DF880

//Custom Code @29-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
global $wars,$newwid,$results_ds;
$results_ds = new clsDBLeague();
$where = " where wid = "
. CCGetFromGet("wid",0)
. " and cid = "
. CCGetFromGet("cid1",0);
$sSQL3 = "update results set score = "
. $wars->ds->ToSQL($wars->ds->Rnds1->GetDBValue(),
$wars->ds->Rnds1->DataType) . ", "
. " pts = "
. $wars->ds->ToSQL($wars->ds->Pts1->GetDBValue(),
$wars->ds->Pts1->DataType) . " "
. $where;

$results_ds->query($sSQL3);
$where = " where wid = "
. CCGetFromGet("wid",0)
. " and cid = "
. CCGetFromGet("cid2",0);
$sSQL4 = "update results set score = "
. $wars->ds->ToSQL($wars->ds->Rnds2->GetDBValue(),
$wars->ds->Rnds2->DataType) . ", "
. " pts = "
. $wars->ds->ToSQL($wars->ds->Pts2->GetDBValue(),
$wars->ds->Pts2->DataType) . " "
. $where;

$results_ds->query($sSQL4);
//End Custom Code

} //Close wars_AfterUpdate @4-FCB6E20C

.



   


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

Web Database

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.