Jump to content

mysqli prepared statements ... don't get any results


Epimetheus1980

Recommended Posts

I'm trying to work with prepared statements, but unfortunately I do not get any result back. I also tried while($stmt->fetch()) { ... }, with the same effect. 

 

Does anyone have a suggestion?

 

Thanks in advance.

<?php
MAKING CONNECTION

if ($stmt = $mysqli->prepare("SELECT year FROM SOMETABLE WHERE id = ? LIMIT 1")) {

    $id = $_GET['id'];
    
    $stmt->bind_param("i", $id);
    
    
    $stmt->execute();
    
    
    $stmt->bind_result($year);
    
    $stmt->fetch();
    
    echo $year;
        
    
    $stmt->close();
}
$mysqli->close();

?>

Archived

This topic is now archived and is closed to further replies.

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