wright67uk Posted April 26, 2013 Share Posted April 26, 2013 What is the right way of binding results when you select * in a mysqli query? Do I have to list every table field, when binding, regardless of wether I need them? $stmt = $mysqli->stmt_init(); if ($stmt->prepare("SELECT * FROM toptips")) { $stmt->execute(); $stmt->bind_result($description); //causes error $stmt->fetch(); $stmt->close(); } $mysqli->close(); echo $description; Quote Link to comment https://forums.phpfreaks.com/topic/277337-select-bind-results-when-using-mysqli/ Share on other sites More sharing options...
lemmin Posted April 26, 2013 Share Posted April 26, 2013 What is the error? Have you tried using mysqli_stmt_prepare()? if (mysqli_stmt_prepare($stmt, "SELECT * FROM toptips")) { From the documentation of mysqli::init_stmt(): Any subsequent calls to any mysqli_stmt function will fail until mysqli_stmt_prepare() was called. http://www.php.net/manual/en/mysqli.stmt-init.php http://php.net/manual/en/mysqli-stmt.prepare.php Quote Link to comment https://forums.phpfreaks.com/topic/277337-select-bind-results-when-using-mysqli/#findComment-1426742 Share on other sites More sharing options...
requinix Posted April 26, 2013 Share Posted April 26, 2013 Do I have to list every table field, when binding, regardless of wether I need them?You have to bind to every column returned. So perhaps you're saying you don't actually want all the columns returned? Quote Link to comment https://forums.phpfreaks.com/topic/277337-select-bind-results-when-using-mysqli/#findComment-1426761 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.