对不起,伙计们,我的意思是我的真实代码就是在我的电脑里。这里不接受PHP代码,只接受HTML,CSS和Java Script。我粘贴HTML
我只是从我的记事本++中复制并粘贴
我的代码:
$conn = new PDO("mysql:host=localhost;dbname=fabio", "root", "");
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$filename = ($_FILES['arquivocsv2']["tmp_name"]);
$abraArq = fopen($filename,"r");
$import = $conn->prepare("INSERT INTO relatorio (DocumentoSD,Descricao,CodCliente,Cliente,Regiao,DataDocumento,Material,Condicoes,Plano)VALUES (:DocumentoSD, :Descricao, :CodCliente, :Cliente, :Regiao, :DataDocumento, :Material, :Condicoes, :Plano)");
$import->bindParam(':DocumentoSD', $DocumentoSD,PDO::PARAM_STR);
$import->bindParam(':Descricao', $Descricao,PDO::PARAM_STR);
$import->bindParam(':CodCliente', $CodCliente,PDO::PARAM_STR);
$import->bindParam(':Cliente', $Cliente,PDO::PARAM_STR);
$import->bindParam(':Regiao', $Regiao,PDO::PARAM_STR);
$import->bindParam(':DataDocumento', $DataDocumento,PDO::PARAM_STR);
$import->bindParam(':Material', $Material,PDO::PARAM_STR);
$import->bindParam(':Condicoes', $Condicoes,PDO::PARAM_STR);
$import->bindParam(':Plano', $Plano,PDO::PARAM_STR);
while (($items = fgetcsv($abraArq, 2048, ';')) !== FALSE) {
$DocumentoSD = $items[0];
$Descricao = $items[4];
$CodCliente = $items[5];
$Cliente = $items[6];
$Regiao = $items[7];
$DataDocumento = $items[10];
$Material = $items[11];
$Condicoes = $items[17];
$Plano = $items[29];
// Execute prepared query
$import->execute();}
答案 0 :(得分:1)
您按价值绑定,而不是通过引用绑定。所以你只是将null绑定到任何地方,因为绑定时,这些变量没有值。您想使用bindParam而不是bindValue。
public static void countTextViewTravelMode(final Integer value, final TextView myView, final CrudStateCallback back){
Integer begin = 0;
try {
begin = Integer.parseInt(myView.getText().toString());
}catch (Exception e){
Log.e("","error trying to get value travel:" + e.getMessage());
}
ValueAnimator animator = ValueAnimator.ofInt(begin, value);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
String string = animation.getAnimatedValue() + "";
myView.setText(string);
}
});
animator.setEvaluator(new TypeEvaluator<Integer>() {
public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
return Math.round((endValue - startValue) * fraction);
}
});
animator.setDuration(1000);
animator.start();
if(back!= null)
back.onResponse("");
}
只取当前值并绑定它。当您进行绑定时,这些变量尚未设置,因此它们的值为bindValue
。
null
,绑定对该变量的引用,以便在值发生变化时,绑定值也会发生变化。