Before I begin I must state I am very new to both php/sql so apologies if my understanding is a little limited.
Ok so basically I have got a site with a user login system where the users can earn points doing various things then exchange them for new functions, for this example I will call the function "user_images".
The transaction is stored in "function_users" which has..
ID
function_id
user_id
cost
date
I have have got the system to the point where the user can visit the shop page, purchase the function and it deducts the appropriate points or currency, my question is to experienced coders, what would the most efficient way to determine if the function is purchased by the user?
Rough example(yes i know it's not msql injection proof it's just an example:
$logged = $_SESSION['user_id'];
$check = mysql_query("SELECT * FROM feature_users WHERE `user_id`='$logged' AND feature_id='1'");
$check = mysql_num_rows($check);
if ($check < 1) {
include/features/user_images.php
?>
I am not asking for someone to write the code for me, I am simply asking the most efficient way to communicate if the user has purchased the feature so it can then display it. Thanks in advance