Hello,
I want to offer users a trial period in a website.
When the users table is created there is no value in trial cell. it has NULL inside.
When a user wants to use a trial period, I check if the user already used this one time offer.
Here is the code:
<?php
session_start();
require_once 'includes/fetch.php';
$username = $_SESSION['username'];
$test = check_free_trial_availability($username);
print_r($test);
?>
Here is the function
function check_free_trial_availability($username)
{
global $db;
try
{
$sql = "SELECT trial
FROM users
WHERE username = :username";
$stmt = $db->prepare($sql);
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->execute();
if($stmt->rowCount() == 0)
return 0;
else
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
catch(Exception $e)
{
return false;
}
}
here is the eror message
How do I solve the problem.
There is no value since the user has’nt subscribed for a trial period