I am developing an RPG game in Unity 3D where player stats, quests, items etc are stored on a mySQL database.
Code for returning quests to the game
$player_id = 1;
$name = $_GET['name'];
$query = "SELECT * FROM `Quests` WHERE `npc_name` = '$name'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$num_results = mysql_num_rows($result);
for($i = 0; $i < $num_results; $i++)
$row = mysql_fetch_array($result);
echo $row['quest_name'] . "*" . $row['quest_text'] . "*" . $row['npc_name'] . "*" . $row['required_items'];
What I would like to do is return quests that the player has not completed. Could someone advise me the best approach.
Would it be best to create another table called
completed_quests and hold the players_id, quest_id, date_completed etc. Then when retrieving a quest it could check this table for completed quests by the players_id.