アットウィキロゴ

ぱんだ ぱんだ 31

<?php
require("calldata.php");

$sql = "SELECT * FROM pdata21";
$result = mysql_query($sql, $link);
$n=1;
while( $row = mysql_fetch_row( $result ) ){
$matrix[$n][1] = $row[0];
$matrix[$n][2]  =$row[1];
$n=$n+1;
}
for ($n=1; $n < 41; $n++) {
$age =$matrix[$n][1];
$rate[$age] = $matrix[$n][2];
}

$sql = "SELECT * FROM pgdata05";
$result = mysql_query($sql, $link);
$n=1;
while( $row = mysql_fetch_row( $result ) ){
$matrix[$n][1] = $row[0];
$matrix[$n][2]  =$row[1];
$matrix[$n][3]  =$row[2];
$matrix[$n][4]  =$row[3];
$n=$n+1;
}
for ($n=1; $n < 5501; $n++) {
$year =$matrix[$n][1];
$age =$matrix[$n][2];
$m2[$year][$age] = $matrix[$n][3];
$f2[$year][$age] = $matrix[$n][4];
}
for ($year=0;$year<100;$year++){
for ($age=20;$age<60;$age++){
$f3[$year][$age]=$rate[$age]*$m2[$year][$age];
}
}
$sql = "truncate pgdata31";
$exe= mysql_query($sql,$link);

for ($year=5;$year<100;$year++){
for ($age=20;$age<60;$age++){
$x=$f3[$year][$age];
$sql = "insert into pgdata31 values($year,$age,$x)";
$exe= mysql_query($sql,$link);
}
}
$close_flag = mysql_close($link);

?>
最終更新:2009年06月11日 05:46