手动导入游戏礼包激活码

策划拿给我一份包含激活码的excel表格card.xlsx,

让我根据不同的礼包在后台数据库里导入相应的激活码,

我将card.xlsx里激活码卡号提取出来放在card.txt中,

写了一个card.php执行此次操作:

<?php
$conn = mysql_connect('localhost','card','card');
mysql_select_db('card');
$listname = file('card.txt');
foreach ($listname as $list)
{  
    $trimList = trim($list);
    if($list !='')
    {
        $query="insert into `t_data_card` (`company_id`,`card_id`,`card_no`,`task_id`,`enable`) value ('15','76','$trimList','220',0)";
        mysql_query($query);
    }
}
exit;


你可能感兴趣的:(mysql,PHP)