Why it is different
I know what the error means (which is one of the answer listed), but am unable to determine what the cause of the error is. It may be something simple I am overlooking, sometimes these things just require a fresh mind. To digress I have searched this site, and google for 2 days and have viewed several threads that do not provide a satisfactory answer to resolve the issue.
Image of SQL Table
Purpose of Code
User purchases small items from points they acquire by obtaining certain goals. (Ex: Walk 5 miles and get a point). This is basically a table that displays the purchases that the use has made with said points..
Error:
Fatal error: Call to a member function bind_param() on a non-object in [DIR OF FILE] on line 137
Line 137
$Select_Points_Receipt_stmt->bind_param('ss', $User, $Type);
conn Variable:
It is pulled from a include file [configure.php]
//Connect to Database
$conn = new mysqli('SERVER', 'DB USERNAME', 'DB PASSWORD', 'DB TABLE');
Code in Question:
$User = $_POST['User'];
$Type = 'Wellness';
$Select_Points_Receipt_Query = "SELECT Purchase_Key, Purchase_Amount, Purchase_Item, Purchase_Date From Purchase WHERE Purchase_User = ? AND Purchase_Type = ?";
$Select_Points_Receipt_stmt = $conn->prepare($Select_Points_Receipt_Query);
$Select_Points_Receipt_stmt->bind_param('ss', $User, $Type);
$Select_Points_Receipt_stmt->execute();
$Select_Points_Receipt_stmt->bind_result($Purchase_Key, $Purchase_Amount, $Purchase_Item, $Purchase_Date);
echo'<h3>Previous Purchases</h3>';
echo'<table>
<tr>
<th>Receipt</th>
<th>Amount</th>
<th>Item</th>
<th>Date</th>
</tr>';
while (mysqli_stmt_fetch($Select_Points_Receipt_stmt))
{
echo'<tr>';
echo'<td>'.$Purchase_Key.'</td>';
echo'<td>'.$Purchase_Amount.'</td>';
echo'<td>'.$Purchase_Item.'</td>';
echo'<td>'.$Purchase_Date.'</td>';
echo'</tr>';
}
echo'</table>';
echo'<br>';
Thanks for the help!