Hi, everyone,
I am using mysql database. I want to do a calculation which involve table1 and update the result of the calculation into table2.
Below is part of my code:
$query="select sum(a) as total, b from table1 where bill_date>='2004-01-01' and bill_date<='2004-06-31' group by c";
$result=@($query);
WHILE ($row=@MYSQL_FETCH_ROW($result))
$number= mysql_num_rows($result);
echo "$number";
for($i=0;$i<$number;$i++){
$c=mysql_result($result,$i,"c");
$d=mysql_result($result,$i,"total");
$query2="update table2 set e='$d' where c='$c'";
$result2=@($query2);
}
I found out that the program only run half way, means total of records is 30000 but update successful into table2 is only 17000 records. Is there something wrong with my coding, or need to configure anything at php.ini or httpd.config???