Jump to content
Sign in to follow this  
NoiiiD

$stmt->get_result error 500

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();

 

Share this post


Link to post
Share on other sites

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.

 

 

Share this post


Link to post
Share on other sites

I tried what you said and it works. Thank you very much. BTW, how should I handle strings with quotes?

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

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