Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3807344
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:58:35+00:00 2026-05-19T14:58:35+00:00

I’m building a web which has a game in it. The game is about

  • 0

I’m building a web which has a game in it.

The game is about getting points for finding certain information in the web.
When the user finds a token, a piece of information, does a checking and he/she gets points for that checking.

Here’s the database I’ve built so far:

CREATE TABLE IF NOT EXISTS `user` (
  `userid` int(11) NOT NULL AUTO_INCREMENT,
  `points` int(11) NOT NULL,
  PRIMARY KEY (`userid`)
) ENGINE=MyISAM  DEFAULT AUTO_INCREMENT=1 ;


CREATE TABLE IF NOT EXISTS `checkings` (
  `checkingsid` int(11) NOT NULL AUTO_INCREMENT,
   `userid` int(11) NOT NULL,
  `tokensid` int(11) NOT NULL,  
   `checked` int(11) NOT NULL,
  PRIMARY KEY (`checkingsid`)
) ENGINE=MyISAM  DEFAULT AUTO_INCREMENT=1 ;


CREATE TABLE IF NOT EXISTS `tokens` (
  `tid` int(11) NOT NULL AUTO_INCREMENT,
  `tokensid` int(11) NOT NULL,
   `name` varchar(255) NOT NULL,
   `points` int(11) NOT NULL,
  PRIMARY KEY (`tid`)
) ENGINE=MyISAM  DEFAULT AUTO_INCREMENT=1 ;

And here’s my code.

The problem with it is: how do I know if the points have been given already for that token?
Please help me with the logic, I’ve lost my scope and I cannot see the way to do it. I have probably started coding in the wrong direction.
I explain what I’m trying to do within the code.

Thanks very much

<?php  
                //connected to database and obtained $userId and $tokenID already
              $query0 = "select * from checkings where userid=".$userId." and tokensid=".$tokenId."";
              $result0 = mysql_query($query0);
              $row0 = mysql_fetch_array($result0); 

               if (($row0['checked']!=' ')|| ($row0['checked']!='0')){ // if checked is empty or 0 the user didn't do the checking in this token yet

                  if (($row0['checked']==1)&&($row0['userid']==$userId)&&($row0['tokensid']==$tokenId) ){//the checking has already been inserted

                      //how many points are given for checking in this token? 
                      $query2 = "select points from tokens where tokensid='".$tokenId."'";
                      $result2 = mysql_query($query2);  
                      $row2 = mysql_fetch_array($result2);
                      $pointstoken = $row2['points']; 

                       //How many points have the user? 
                      $query3 = "select points from user where userid='".$userId."'";
                      $result3 = mysql_query($query3);  
                      $row3 = mysql_fetch_array($result3);
                      $pointsUser = $row3['points'];  

                      //user points are updated after checking in this token 
                      $pointsTotal = $pointsUser+$pointstoken;  
                      $query4 = "update user set points=".$pointsTotal." where userid=".$userId." ";
                      $result4 = mysql_query($query4);  



                    }else{//here I do the checking in the token inseting the ids plus a 1 as for checked 
                      $query1 = "insert into checkings (userid, tokensid,checked ) values (".$userId.",".$tokenId.",1)";
                      $result1 = mysql_query($query1);


                  }   

               }else{ echo "Hi, user ".$userId." you've already done the checking in token id ".$tokenId." ";}
     ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:58:36+00:00Added an answer on May 19, 2026 at 2:58 pm

    Does the checkings table store which checkings the user has found?

    In that case, serach that table before awarding the user any points.

    If not, create a table for user + checkings/tokens that keep track on each item the user has found and been awarded and search that table every time the user submits a find.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.