I am trying to use this code in order to echo some information, which is required to have a bind_param, in order to generate the data. What changes do I need to make to this code in order to get it to work?
function get_header_link($sql, $image)
{
include 'connect.php';
$id = $_GET['id'];
$select = $conn->prepare($sql);
$select->bind_param('s', $id);
if ($result = $select->execute()) {
foreach($select as $value => $row) {
echo "<h4>" . $row['display'] . "</h4>\n
<div class='placeholder' id='large'>\n
<img src='" . $row[$image] . "'/>\n
<div class='name'>
<h1>" . $row['display'] . "</h1>\n
</div>
</div>";
}
}
}
On running the code above, using:
get_header_link("SELECT * FROM homelinks WHERE linkID=?", "large_image");
I no longer get an error, and none of the data from the database is printing.