Jump to content

$stmt->get_result error 500


NoiiiD
Go to solution Solved by Jacques1,

Recommended Posts

Im having trouble on my php script. it is working on my computer but when I put it in x10hosting it fails and gives an error 500.  I tried tracing the problem and I found out that it happens if I call get_result. Here is the part code:

 

 

$username = strtolower(filter_input(INPUT_POST, 'username'));
  $password = filter_input(INPUT_POST, "password");
  $remember = filter_input(INPUT_POST, "remember");
  $result = array();
  include 'Connection.php';
  $query = "SELECT Number, Username, Password, Alias, Level FROM user WHERE Username = ?;";
  $stmt = $conn->prepare($query);
if(!$stmt->prepare($query))
{
    die( "Failed to prepare statement.");
}
  $stmt->bind_param("s", $username);

  $stmt->execute();
  echo $stmt->error;

//error hapens here
  $selectResult = $stmt->get_result();

 

Link to comment
Share on other sites

  • Solution

The get_result() method is only available for the MySQL native driver (which your server appearently doesn't have). You either have to change the PHP installation or fetch the data with the classical bind_result/fetch.

 

By the way, remove this filter_input() stuff. It will damage the incoming data and serves no purpose whatsoever.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.