Installed php 5.4.21, but getting 'undefined method mysqli_stmt::get_result() ' still?

morrow95

Well-Known Member
Oct 8, 2006
160
8
168
I am in the process of rewriting into prepared statements and have the following :

Code:
	// Store user db info in session for use
	$stmt = $mysqli->prepare("SELECT id,user,pass,email,timezone,lastIP,currIP,dtLastLogin,dtCurrLogin FROM test_users WHERE user = ?");
	// bind params
	$stmt->bind_param('s', $user);
	// execute prepared statement
	$stmt->execute();
	// results to array
	$rs = $stmt->get_result();
	$arr = $rs->fetch_all(MYSQLI_ASSOC);
	// close statement
	$stmt->close();
	//store array into session
	$_SESSION['user']= $arr;
but am getting a 'Fatal error: Call to undefined method mysqli_stmt::get_result() '. I realized my php was an older version and went ahead and installed 5.4.21 through easy apache.. confirmed with echo phpversion(); and still get the error.

I was under the assumption that 5.4 would correct this issue with the native driver needed for this statement... is that wrong? MySQL version is 5.1.70-cll.

Any ideas?
 

mtindor

Well-Known Member
Sep 14, 2004
1,363
65
178
inside a catfish
cPanel Access Level
Root Administrator
I am in the process of rewriting into prepared statements and have the following :

Code:
	// Store user db info in session for use
	$stmt = $mysqli->prepare("SELECT id,user,pass,email,timezone,lastIP,currIP,dtLastLogin,dtCurrLogin FROM test_users WHERE user = ?");
	// bind params
	$stmt->bind_param('s', $user);
	// execute prepared statement
	$stmt->execute();
	// results to array
	$rs = $stmt->get_result();
	$arr = $rs->fetch_all(MYSQLI_ASSOC);
	// close statement
	$stmt->close();
	//store array into session
	$_SESSION['user']= $arr;
but am getting a 'Fatal error: Call to undefined method mysqli_stmt::get_result() '. I realized my php was an older version and went ahead and installed 5.4.21 through easy apache.. confirmed with echo phpversion(); and still get the error.

I was under the assumption that 5.4 would correct this issue with the native driver needed for this statement... is that wrong? MySQL version is 5.1.70-cll.

Any ideas?
I was under the impression that mysqlnd is not provided by default in a cPanel install [because, at least at one point, mysqlnd would not authenticate against 16-byte old style passwords]. In a fairly old thread somewhere on the forum here, cPanelKenneth was telling somebody this. This was in a PHP 5.3 discussion. I don't know if it's still true or not.

But if you need mysqlnd, I think you'll have to add something to rawopts and recompile to have that support in your PHP. I'm not a programmer, so I don't know if mysqlnd is what you're referring to, but I presume it is when you say 'native driver'.

You might want to do a search on these forums for cpanel mysqlnd, or you can do a Google search for cpanel mysqlnd and you'll find what I'm referring to.

Mike
 

morrow95

Well-Known Member
Oct 8, 2006
160
8
168
Yes, mysqlnd is what I am talking about. Afterwards I also found the same references here on the forum. Apparently it isn't included still.

I went ahead and rewrote what I needed to in PDO last night and am good to go. Just glad I found out now rather than later. I still had quite a bit of work to rewrite regardless.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
I went ahead and rewrote what I needed to in PDO last night and am good to go. Just glad I found out now rather than later. I still had quite a bit of work to rewrite regardless.
I am happy to hear you were able to get that sorted out. Thank you for updating the thread with the outcome.