我们使用以下代码从数据库中获取佣金并在列中显示。
$stmt = $user_home->runQuery("SELECT commission1 FROM tbl_users where userID=:uid");
$stmt->execute(array(":uid" => $_SESSION['userSession'])); // this line
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$commission = $row['commission1'] ;
我们使用以下代码添加这些佣金和&给出总佣金的价值:
var commission=0;
for (var i = 0; i < mygrid.dataset.data.length; i++) {
console.log(mygrid.dataset.data[i]);
if(mygrid.dataset.data[i][10] != "Returned" && mygrid.dataset.data[i][10] != "Cancelled"){
commission=commission+parseInt(mygrid.dataset.data[i][8]);
}
console.log(commission);
}
$(".delete_grid").append(" , Total commission : "+commission);
但问题是它从数据库获取错误的佣金,所以我们更换为以下代码以获取正确的佣金:
$stmt = $user_home->runQuery("SELECT commission1 FROM tbl_users where userID=:uid "); //I assume user_id is field of database in tbl_user table
$stmt->execute(array(":uid" => $productdetail->getDesignerID() )); // this line
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$commission = $row['commission1'] ;
现在问题是总佣金显示“NaN”
经过研究,我得到初始化一些变量,但我是javascript&amp;的新手。我没有得到我需要初始化的价值。
更新
我删除了一些html form
代码后,我跟着Rajesh的消息:console.log(mygrid.dataset.data[i][8])
我在控制台出错:
Uncaught TypeError: Cannot read property '8' of undefined at line 436
<form>
Search:
<select id="f_value2">
<option value="entity_id">Order Id</option>
</select>
<input type="text" onkeyup="doFilter()" value="" id="f_value1" >
<input type="reset" value="Reset" onClick="window.location.reload()"> // line 436
</form>
更新2
答案 0 :(得分:0)
信用:Rajesh
[string][ValidateNotNullOrEmpty()]$passwd = "something"
$secpasswd = ConvertTo-SecureString -String $passwd -AsPlainText -Force
$mycreds = New-Object Management.Automation.PSCredential ("test", $secpasswd)