$arSql[] = 'truncate table `test`';
$arSql[]='set @mycnt = 0;';
$arSql[]='insert into test (id, row, username ) select id, (@mycnt := @mycnt + 1) as t_or, user from order by num desc;'改$arSql[0] = 'truncate table `test`';
$arSql[1]='set @mycnt = 0;';
$arSql[2]='insert into test (id, row, username ) select id, (@mycnt := @mycnt + 1) as t_or, user from order by num desc;'不要自己发明创造语法

解决方案 »

  1.   

    $arSql[]="truncate table `test`;\n@mycnt = 0;\ninsert into test (id, row, username ) select id, (@mycnt := @mycnt + 1) as t_or, user from order by num desc;";这样试试看.
      

  2.   

    你一条一条测试吧
    用echo,看数组里返回的变量,不要想当然
      

  3.   

    或者用print_r打印你的数组变量,看看查询语句是否有变化