Thank you to everyone who has contributed to any of my other questions. It has helped me to have a much greater understanding of classes, functions and prepared statements - and their purposes. But one last question, cos I just can't put all the pieces together myself!
For the following example of a prepared statement, can somebody show me how I can store the query, bind parameters and bind results valies in a separate file (include.php), include them and "call" them in example.php
include.php
For the following example of a prepared statement, can somebody show me how I can store the query, bind parameters and bind results valies in a separate file (include.php), include them and "call" them in example.php
include.php
<?php ... ?>example.php
<? include 'include.php' $stmt = $mysqli->prepare("SELECT heading, content FROM miscellaneous WHERE id = ?"); $stmt->bind_param('i', $id); $stmt->execute(); $stmt->bind_result($heading, $content); $stmt->fetch(); $stmt->close(); ?>I would be SO grateful as I have tried to work this out for myself for 3 or 4 days before consulting this forum - with no success!