require("inc/connection.php");
if ($link->connect_error)
die('Connect Error: '.$link->connect_errno.': '.$link->connect_error);
$insertedcode = $_POST['code'];
$results = $link->query("SELECT code FROM code WHERE code = :code");
$query_params = array(
':code' => $_POST['code']
);
$stmt = $link->prepare($results);
$result = $stmt->execute($query_params);
$row = $stmt->fetch();
if($row) {
$number = mt_rand(0,3999);
echo $number;
}
This is what I have I think I have the random number part down. But for some reason it gives me this error:
Fatal error: Call to a member function execute() on a non-object in C:\wamp\www\RoLuck\dashboard.php on line 21
It wont execute and Im not sure why.