php mysql code not working on server

Jun 5, 2015
Reaction score
I have all my code written for a uni assignment due tomorrow and ive been slapped round the face by [mucks edit] my 'host' as the code which works really well on my localhost machine doesnt on their server. I think it mayhave somthing to do witht the
$result = mysqli_stmt_get_result($stmt);

line of code. This is the new error message:
Fatal error: Call to undefined function mysqli_stmt_get_result() in /home/hear2see/public_html/index.php on line 90

But im really unsure and would be greatful of any help. I have made sure the mysqlnd driver is ticked in the PHP modules.

example of complete code for login page:
header('Cache-Control: no cache'); //no cache

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<link rel="stylesheet" href="//">

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="">

<!-- Optional theme -->
<link rel="stylesheet" href="">

<!-- Latest compiled and minified JavaScript -->
<script src=""></script>

<!-- Include Modernizr in the head, before any other Javascript -->
<script src="includes/js/modernizr-2.6.2.min.js"></script>

<script src="//"></script>

<script src="//"></script>

<link href=',700' rel='stylesheet' type='text/css'>

<link rel="stylesheet" href="bootstrap.css">

<link rel="stylesheet" href="stylez.css">

<title>Login Form</title>


<body style="color:#68748D; background-color:black; text-align:center">
<!-- Navbar creation - Code adapted from -->
<nav class="navbar">
<div id="custom-bootstrap-menu" class="navbar navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header"><a href="main.php"><img src="logo1.png" alt="logo" title="logo" style="width:140px; height:50px" class="navbar-brand"></a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
<!-- Collapsable navbar for smaller devices -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<a href="main.php">Browse</a>
<a href="upload.php">Upload Event</a>
<a href="logout.php?">Logout</a><!-- If session is set display logout -->

<div class="container-fluid">

<div class="row">


$okay = TRUE;

$con = mysqli_connect('localhost','root','','python');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}//Establish connection

$query = "SELECT * FROM login WHERE email= ? AND password = ?"; //Check password and email
$crypt = crypt($_POST['email'],'$1$asdf1234$');
$cryptp = crypt($_POST['password'], '$1$asdf1234$');//Encrypt both entered username and passowrd to match with database content
$_SESSION['email'] = $crypt;//If email and passwords match, initiate session
$_SESSION['password'] = $cryptp;
$stmt = $con->prepare($query);
$stmt ->bind_param('ss', $_SESSION['email'], $_SESSION['password']);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_array($result);

if (empty($row)){ //If results list empty display error
echo "<h2>Wrong username or password!<br></h2>";
echo "<a href=index.html>Login</a>";
$okay = FALSE;
} else {

$_SESSION['currentUser'] = ($row['user']);
echo "<h1 style='text-align:center'>Welcome back ".$_SESSION['currentUser']. "!</h1>";//Display username logged in
print '<h3><p>Your Events<br><br></h3></p>';
//Display events logged in user has listed already. Union selects from multiple tables
$sql="SELECT * from london where user = ? UNION SELECT * from manchester where user = ? UNION SELECT * FROM bristol where user = ? UNION SELECT * FROM yorkshire where user = ? UNION SELECT * FROM newcastle where user = ? UNION SELECT * FROM lancashire where user = ? UNION SELECT * FROM glasgow where user = ? UNION SELECT * FROM liverpool where user = ? UNION SELECT * FROM edinburgh where user = ? UNION SELECT * FROM surrey where user = ? UNION SELECT * FROM birmingham where user = ? "; $stmt2 = $con -> prepare($sql);
$stmt2 -> bind_param('sssssssssss', $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser'], $_SESSION['currentUser']);
$result1 = mysqli_stmt_get_result($stmt2);

if($stmt2){ //If $stmt exectuted, display results in Bootstrap hover table
echo "<table class='table table-hover'><thead>
//While $row contains result, execute the while loop
while($row = mysqli_fetch_array($result1)) {
echo "<tr>";
echo "<td>" . $row['artist'] . "</td>";
echo "<td> <b>Venue: </b>" . $row['venue'] . "<p><b>Location: </b>" . $row['location'] . "</td>";
echo "<td>" . $row['datez'] . "</td>";
echo "<td>" . $row['genre'] . "</td>";
//Dispay Soundcloud link to a track by artist in $row['artist']
echo "<td>" . '<iframe width="100%" height="100" scrolling="no" frameborder="no" src="' . $row['link'] . '&amp;color=000000&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"></iframe>' . "</td>";
echo "</tr>";

echo "</table>";
} else echo "error";//If theres no $stmt display error

mysqli_close($con); //Close Connection





<script src="//"></script>


Last edited by a moderator:



Feb 23, 2002
Reaction score
Welcome to the forums :).

You'll also need "MySQLi" enabled, I'd check the output from phpinfo() and see if it is there. If not, you can add it via php.ini by adding this to the extensions list:



Jun 8, 2015
Reaction score
Install mysql native

apt-get install php5-mysqlnd

enable mysqlnd in php.ini

mysqlnd.net_cmd_buffer_size = 2048
mysqlnd.net_read_buffer_size = 32768

very good!

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question