以下のコードを機能させようとしていますが、機能しておらず、以下のエラーが表示されます
Fatal error: Call to a member function bind_param() on a non-object in
準備されたステートメントで配列をフェッチする方法はありますか?
if (move_uploaded_file($_FILES['file_to_upload']['tmp_name'], $final_uploads_location))
{
$stmt = $mysqli->prepare("select * from test where `username` = ? and `age` = ? ");
$stmt->bind_param('ss', $username, $age);
$stmt->store_result();
$stmt->execute();
if($stmt->num_rows < 1)
{
$insert = $mysqli->prepare("insert into `test`(`username`, `age`, ) values(?,?)");
$insert->bind_param('ss', $username, $age);
$insert->execute();
}
else
{
$check = mysqli_fetch_array($stmt);
global $identity;
}
}