Epimetheus1980 Posted July 9, 2014 Share Posted July 9, 2014 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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/289627-mysqli-prepared-statements-dont-get-any-results/ Share on other sites More sharing options...
cyberRobot Posted July 9, 2014 Share Posted July 9, 2014 Have you checked if there are any MySQL errors? Try adding the following debug line before closing the database connection: echo $mysqli->error; Quote Link to comment https://forums.phpfreaks.com/topic/289627-mysqli-prepared-statements-dont-get-any-results/#findComment-1484385 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.