I have 1 PHP file(query), 1 HTML/PHP File(results). I want a prepared statement to query all Data(column1) based on column2 value then put inside a div in another file. I have been trying this for hours and cant seem to get the prepared statement of my own to display the data in the div... Any help would be great, thanks.
Table name: tasks
Column2 = status
Column2 value = o
Column1 = id
PHP file:
<?php
include 'sqlconnection.php';
$conn = OpenCon();
if ($stmt = $conn->prepare ( "SELECT id from tasks
where status=?" ))
{
$stmt->bind_param ( "s", $o);
$stmt->execute ();
$stmt->bind_result ($id);
$arrayUsers = array();
while ($stmt->fetch())
{
if (isset ($id))
{
$arrayUsers[] = array(
"id" => $id);
}
}
$stmt->close ();
}
CloseCon($conn);
?>
PHP File with HTML:
<div class='task-listing'>
<h1><?= $id ?></h1>
<h1><?= $id ?></h1>
<h1><?= $id ?></h1>
</div>