|
|
|
Insert ข้อมูล ไม่ได้ ช่วยดู code ด้วยค่ะ INSERT INTO renew (id, startdate, enddate,) VALUES ('$id', '$startdate', '$enddate') |
|
|
|
|
|
|
|
Code (PHP)
<?
$host="localhost";//�������
$user="root";//���ͼ����ҹ�ҹ������
$pass="";//���ʼ����ҹ�ҹ������
$db="4digits";//���Ͱҹ������
mysql_connect( $host,$user,$pass) or die ("�Դ��͡Ѻ�ҹ������ Mysql ����� ");
mysql_select_db($db) or die ("�������ö��Ҷ֧���ҧ��");
mysql_query("SET NAMES UTF8");
$sql = "select * from renew" ;
$db_query=mysql_db_query($db,$sql);
$a=0;
while ( $result = mysql_fetch_array($db_query) )
{
$e=$result[enddate];
$s=$result[startdate];
$id = $result[id];
$ss = strtotime( $s );
$ee = strtotime( $e );
while (date('Y', $ss) < 2012 )
{
$startdate = mktime(0,0,0,date('m', $ss),date('d',$ss),date('y', $ss)+1);
$startdate = date( 'Y-m-d', $startdate );
$enddate = mktime(0,0,0,date('m', $ee),date('d',$ee),date('y', $ee)+1);
$enddate = date( 'Y-m-d', $enddate );
echo $id;
echo "/";
echo $startdate;
echo $enddate;
echo "<BR>";
$strSQL="INSERT INTO renew (id, startdate, enddate,) VALUES ('$id', '$startdate', '$enddate')";
echo $strSQL;
$result=mysql_db_query($db,$strSQL);
$ss = strtotime( $startdate);
$ee = strtotime( $enddate);
$b++;
}
//$strSQL = "UPDATE renew SET renew.enddate = '$enddate' where id = $id " ;
$a++;
}
mysql_close() ;
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-02-13 01:35:21 |
By :
garfieldgril |
View :
970 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$strSQL="INSERT INTO renew (id, startdate, enddate,) VALUES ('$id', '$startdate', '$enddate')";
|
|
|
|
|
Date :
2012-02-13 01:58:27 |
By :
ikikkok |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|