Hi everyone, I wanted to some investigating before I label this as a bug, but from what I can see I'm not getting expected results. It appears as if mysqli_stmt_result_metadata does not return the proper object. It should be of mysqli_result type, but yet when I run mysqli_num_rows against it, I get 0, always. If I do a direct mysqli_query and take the resultset back, I can call mysqli_num_rows and it returns the proper value.
Example #1(doesn't work):
if($this->statement = mysqli_prepare($this->databaseConnection, "SELECT 1 FROM DIGIUSERS WHERE UNAME = ?"))
{
mysqli_stmt_bind_param($this->statement, 's', $username);
mysqli_stmt_execute($this->statement);
$this->errorQuery();
$result = mysqli_stmt_result_metadata($this->statement);
//Ooops, the username is already taken! exit with status of -7
if(mysql_num_rows($result) > 0) {
mysqli_rollback($this->databaseConnection);
exit("<STATUS>-7</STATUS></USER>");
}
mysqli_stmt_close($this->statement);
}
Example #2 (works but i cant bind variables):
$result = mysqli_query($this->databaseConnection, "SELECT 1 FROM DIGIUSERS WHERE UNAME = $username");
$this->errorQuery();
//Ooops, the username is already taken! exit with status of -7
if(mysqli_num_rows($result) > 0) {
mysqli_rollback($this->databaseConnection);
exit("<STATUS>-7</STATUS></USER>");
}
I have variable binding working just fine elsewhere on the site so I know it's not that. The only thing I can think of is that mysqli_stmt_result_metadata is not returning the proper object. For now i will use #2 but, very begrudgingly....