写一个PHP文件,自动循环创建MYSQL表,20分相送表名定义:table20100531,table20100601,table20100602............................table20101231字段为:name text    date1 int 11建1年的表 怎么写循环啊

解决方案 »

  1.   

    create table yourtable (name text, date1 int,timestamp int)
    这样不好吗 用timestamp存你的20100531等等等。
      

  2.   

    $t = date('Y').'0101';
    for($i=0;$i<366;$i++){
     $tabname = 'table' . date('Ymd',strtotime($t) + $i*86400);
     $sql = 'create table $tabname .....';
     mysql_query($sql);
    }
      

  3.   

    写是可以写 可是你这需求也太
    谁让你用一年日期做表的啊 我觉得没这个必要啊 for($n=0;$n<365;$n++){
    $table_name = "table".date("Ymd",time()+24*60*60*$n);
    mysql_query(" create table {$table_name}( name text, date1 int(11) ); ");
    }
    }
      

  4.   

    Gooooooooooooooooooooooooooooooooooooooooooooooooood
      

  5.   

    方便统计,加快sql语句的查询速度最好是是用他这种方式,好管理,好统计,不会增加查询表的负担