Jump to content

null7238

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by null7238

  1. Unknown function mysqli_stmt_get_result, looks like this might just be in an alpha build. This is a partially prod environment so I can't be running alpha builds Can anyone confirm? Thank you again for your super fast replies
  2. Thank you for the replies. I was using the mysqli function sorry, it's been hectic today and I just slapped the code in here quickly. It still does not make sense to me why the meta data does not work. Either documentation needs to be changed to let users know it's not an actual resultset...or something... kicken, thank you for that but I believe at this point the solution I found is more efficient anyways
  3. As per my usual fashion, I kept cracking at this to find a solution that would work for me. If anyone runs into this problem where you need to see if rows exist, do this instead. 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(mysqli_stmt_fetch($this->statement)) { mysqli_rollback($this->databaseConnection); exit("<STATUS>-7</STATUS></USER>"); } mysqli_stmt_close($this->statement); } that way if you fail to fetch a row, it will return null...or an error, either way it only returns true if it grabs row(s). Hope this helps someone out in the future. Still hoping someone can key in on the metadata issue, I have a feeling this is a bug in the API.
  4. 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....
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.