NoiiiD Posted January 26, 2016 Share Posted January 26, 2016 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(); Quote Link to comment https://forums.phpfreaks.com/topic/300658-stmt-get_result-error-500/ Share on other sites More sharing options...
Solution Jacques1 Posted January 26, 2016 Solution Share Posted January 26, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/300658-stmt-get_result-error-500/#findComment-1530415 Share on other sites More sharing options...
NoiiiD Posted January 27, 2016 Author Share Posted January 27, 2016 I tried what you said and it works. Thank you very much. BTW, how should I handle strings with quotes? Quote Link to comment https://forums.phpfreaks.com/topic/300658-stmt-get_result-error-500/#findComment-1530461 Share on other sites More sharing options...
Jacques1 Posted January 27, 2016 Share Posted January 27, 2016 What do you mean? What's the problem? Quote Link to comment https://forums.phpfreaks.com/topic/300658-stmt-get_result-error-500/#findComment-1530467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.