PHP比较两个变量的结果,结果为;stdClass无法转换为int";
我试图使用一个简单的比较函数来比较MySQLi数据库查询的结果,但我一直得到以下代码片段的“stdClass无法转换为int”:PHP比较两个变量的结果,结果为;stdClass无法转换为int";,php,apache-flex,Php,Apache Flex,我试图使用一个简单的比较函数来比较MySQLi数据库查询的结果,但我一直得到以下代码片段的“stdClass无法转换为int”: $stmt = mysqli_prepare($this->connection, "SELECT access_user_id, failed_login_count FROM $this->accesstable where username=?"); $this->throwExceptionOnError();
$stmt = mysqli_prepare($this->connection, "SELECT access_user_id, failed_login_count FROM $this->accesstable where username=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 's', $trimmedUsername);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $user_id->access_user_id, $failed_login_count->failed_login_count);
$failed_login_count = (int)$failed_login_count;
if(mysqli_stmt_fetch($stmt)) {
if($failed_login_count < 10) {
$stmt=mysqli\u prepare($this->connection,“从$this->accesstable中选择access\u user\u id,failed\u login\u count,其中username=?”;
$this->throweExceptionOnError();
mysqli_stmt_bind_param($stmt,$s',$trimmedUsername);
$this->throweExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throweExceptionOnError();
mysqli_stmt_bind_result($stmt,$user_id->access_user_id,$failed_login_count->failed_login_count);
$failed_login_count=(int)$failed_login_count;
如果(mysqli_stmt_fetch($stmt)){
如果($failed\u login\u count<10){
最后一行是抛出错误的内容…我做错了什么?$failed\u login\u count->failed\u login\u count,这是上面写的对象尝试在测试中使用相同的对象将类转换为整数
$failed\u login\u count=(int)$failed\u login\u count;
但也许您应该执行$failed\u login\u count=$failed\u login\u count->failed\u login\u count;
这就解决了执行问题,但是,“if($failed\u login\u count<10)”仍然计算为false,即使数据库值为21。。。