fail to add data into table
Posted by:
rozz med
Date: May 26, 2005 02:24AM
hi everybody,
please help me. I'm trying to create a table and insert with calculated data below, but have a problem to add calculated data into my table.
this is my code:
<?
include '../include/db.class';
$db_conn = mysql_connect( "localhost", "license","3431" );
if (!$db_conn) echo "Could not connect to database server - please try later.";
mysql_select_db( "sample_User" );
function dateCalculation()
{
$sql = new db;
$sql->open();
/* set date */
$dateStart = mktime(0,0,0,01,01,2005);
$Last_date_calc = mktime(0,0,0,12,31,2005);
$w = 1;
while ($dateStart < $Last_date_calc)
{
$dateEnd = $dateStart + (60*60*24*6);
$dateStartDay = date("d",$dateStart);
$dateStartMn = date("m",$dateStart);
$dateStartYr = date("Y",$dateStart);
$date_start = $dateStartYr."-".$dateStartMn."-".$dateStartDay;
$dateEndDay = date("d",$dateEnd);
$dateEndMn = date("m",$dateEnd);
$dateEndYr = date("Y",$dateEnd);
$date_end = $dateEndYr."-".$dateEndMn."-".$dateEndDay;
print "Date Start : $date_start\n";
print "Date End : $date_end\n";
print "Week : $w\n\n";
$week_array = array ( date_start=>$date_start,date_end=>$date_end,week=>$w);
$sql->addWeekSub($week_array);
$dateStart = $dateEnd + (60*60*24);
$w++;
//$current_week = ceil(date('z') / 7+.5);
} // end while
$sql->close();
}//end function dateCalculation
?>
please help me!