eMonk Posted August 6, 2013 Share Posted August 6, 2013 What am I doing wrong in the code below? $qry1 = $db->prepare("SELECT id FROM user WHERE username = ? AND password = ?"); $qry1->bind_param('ss', $_GET['username'], sha1($_GET['password'])); $qry1->execute(); $db->bind_result($result_1); Fatal error: Call to undefined method mysqli::bind_result() Quote Link to comment https://forums.phpfreaks.com/topic/280875-bind_result/ Share on other sites More sharing options...
mac_gyver Posted August 6, 2013 Share Posted August 6, 2013 that's because ->bind_result() is a method of the mysqli_stmt class. it's not a method of the mysqli class. Quote Link to comment https://forums.phpfreaks.com/topic/280875-bind_result/#findComment-1443617 Share on other sites More sharing options...
eMonk Posted August 6, 2013 Author Share Posted August 6, 2013 I'm trying this now but still getting an error: Fatal error: Call to undefined method mysqli_stmt::get_result() $result_1 = $qry1->get_result(); I'm new to mysqli prepared statements been reading about it online and in my php book but can't seem to figure this part out? Quote Link to comment https://forums.phpfreaks.com/topic/280875-bind_result/#findComment-1443622 Share on other sites More sharing options...
mac_gyver Posted August 6, 2013 Share Posted August 6, 2013 i recommend you make use of the php.net documentation. there are examples and conditions/limitations listed in the documentation. a) why did you switch from using ->bind_result()? b) there's a very specific restriction for when ->get_result() is available - MySQL Native Driver OnlyAvailable only with mysqlnd. Quote Link to comment https://forums.phpfreaks.com/topic/280875-bind_result/#findComment-1443623 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.