RonB
|
Posted: 05/05/2002, 5:20 AM |
|
I hope I got it wright just wondering how to pump the query to the database.
The old method used $db->query.
How do I make sure it's getting to the database now?
Here's the code:
//setting the insert id
$sesid=mysql_insert_id();
CCSetSession($InsertId,$sesid);
//setting some variables
$date1='2002-01-01 ';
$date2='2002-01-02 ';
$van=strtotime( $date1 .$fzortextra->Van->Value);
$tot=strtotime($date1 .$fzortextra->Tot->Value);
$zes= strtotime($date1 .'06:00:00');
$zeven=strtotime($date1 .'07:00:00');
$acht=strtotime($date1 .'08:00:00');
$twintig=strtotime($date1 .'20:00:00');
$twaalf=strtotime($date1 .'12:00:00');
$tien=strtotime($date1 .'22:00:00');
$nul=strtotime($date1 .'00:0:01');
$nul1=strtotime($date1 .'23:59:59');
// the function I'm using
function time_diff($van,$tot,$a,$b)
{
if(($tot <= $a))
{
$veld ='0';
}
elseif(($van >= $b))
{
$veld ='0';
}
elseif(( $van >= $a) && ($van <$b)&& ($tot <= $b) )
{
$veld=($tot - $van)/60 /60;
}
elseif(($van <= $a )&( $tot >= $b))
{
$veld=($b-$a)/60 /60 ;
}
elseif(($van <= $a)&&($tot <= $b))
{
$veld=($tot - $a)/60 /60;
}
elseif(($van >= $a)&& ($tot > $b))
{
$veld=($b -$van)/60 /60;
}
return round($veld,1);
}
//the actual actions
if(($fldDag >= 1)&& ($fldDag <= 5) && ($fldFeestdag == 0))
{
$fzortextra->Ma_vrijdag06->setvalue(time_diff($van,$tot,$null,$zes));
$fzortextra->Ma_vrijdag67->setvalue(time_diff($van,$tot,$zes,$zeven));
$fzortextra->Ma_vrijdag2022->setvalue(time_diff($van,$tot,$twintig,$tien));
$fzortextra->Ma_vrijdag2224->setvalue(time_diff($van,$tot,$tien,$nul1));
$sSQL1 = "update fzortextra set " .
"Ma_vrijdag06=" . CCToSQL($fzortextra->Ma_vrijdag06->Value, "Number") .
",Ma_vrijdag67=" . CCToSQL($fzortextra->Ma_vrijdag67->Value, "Number") .
",Ma_vrijdag2022=" . CCToSQL($fzortextra->Ma_vrijdag2022->Value, "Number") .
",Ma_vrijdag2224=" . CCToSQL($fzortextra->Ma_vrijdag2224->Value, "Number");
$sWhere1="id=" .CCToSQL(CCGetSession($InsertId), "Number");
$sSQL1 .= " where " . $sWhere1;
$db->query($sSQL1);
}
if(($fzortextra->Dag->Value == 6)&& ($fzortextra->Feestdag->Value == 0))
{
$fzortextra->Zaterdag06->setvalue(time_diff($van,$tot,$null,$zes));
$fzortextra->Zaterdag68->setvalue(time_diff($van,$tot,$zes,$acht));
$fzortextra->Zaterdag1222->setvalue(time_diff($van,$tot,$twaalf,$tien));
$fzortextra->Zaterdag2224->setvalue(time_diff($van,$tot,$tien,$nul1));
$sSQL2 = "update fzortextra set " .
"Zaterdag06=" . CCToSQL($fzortextra->Zaterdag06->Value, "Number") .
",Zaterdag68=" . CCToSQL($fzortextra->Zaterdag68->Value, "Number") .
",Zaterdag1222=" . CCToSQL($fzortextra->Zaterdag1222->Value, "Number") .
",Zaterdag2224=" . CCToSQL($fzortextra->Zaterdag2224->Value, "Number");
$sWhere2="id=" .CCToSQL(CCGetSession($InsertId), "Number");
$sSQL2 .= " where " . $sWhere2;
$db->query($sSQL2);
}
if($fzortextra->Dag->Value == 7 or $fzortextra->Feestdag->Value == 1)
{
$fzortextra->Zon_feestdag->setvalue( ($tot - $van)/60 /60);
$sSQL3="update fzortextra set " . "Zon_feestdag=".
CCToSQL($fzortextra->Zon_feestdag->Value, "Number");
$sWhere3="id=" .CCToSQL(CCGetSession($InsertId), "Number");
$sSQL3 .= " where " . $sWhere3;
$db->query($sSQL3);
}
Again I know the portion of the code concerning outputting the query to the
database is wrong that's my problem...what is it supposed to be?
Ron
|
|
|
|