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

  • Home
  • SEARCH
  • 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 9057761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:32:34+00:00 2026-06-16T14:32:34+00:00

I would really appreciate once again if someone could help me out! I’m working

  • 0

I would really appreciate once again if someone could help me out! I’m working on a registration form which works fine, but I wanted to implement an invitation code check in there, too.

I never did that before and since I’m a newbie I just searched for a solution, tried to understand and to adopt…so please don’t judge me 🙂 I’m just trying to learn with each step!

So quick what I’m trying to do ->

  1. user types in an invitation code
    2.if incorrect (checked in the database then -> error msg)
  2. if correct (checked in database -> then gets used)
  3. code database gets updated that the code is not usable anymore

here is my code:

$invite_code = ($_POST['invite_code']);
// Validate invite code
if (empty($_POST['invite_code'])) {
$err7 = "Wrong invitation code";
}  
//check if invitation code is valid in the database and not already taken
$rs_check = mysql_query("SELECT `code` from tableinvitecodes WHERE '$invite_code' 
AND `taken` = '0'") or die (mysql_error()); 
$num = mysql_num_rows($rs_check);
// Match row found with more than 0 results  - the code is invalid. 
if ( $num <= 0) { 
$err7 = "Invite code is invalid";
}
else {
$invite_code = $_POST['invite_code'];
}

what’s not workin is the check for the “being used already”, it gets updated in the database..that’s working fine. The mistake must be the checking but I don’t know how to connect it with the “if (empty($_POST[‘invite_code’]))…” :-/

Thanks in advance for your help!

and that part works! ->

//set approved code to 1 to block that code
if(empty($err7)) {
$rs_invite_code = mysql_query("update tableinvitecodes set `taken` = '1' WHERE 
code='$invite_code' ") or die(mysql_error());
}
  • 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-06-16T14:32:36+00:00Added an answer on June 16, 2026 at 2:32 pm

    It looks like your query is mal-formed. You have:

    SELECT `code` from tableinvitecodes WHERE '$invite_code' AND `taken` = '0'
    

    I think you should have something like:

    SELECT `code` from tableinvitecodes WHERE <<SOMETHING HERE>> = '$invite_code' AND `taken` = '0'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would really appreciate it if some of you could help optimize my tables,
I would really appreciate any jquery expert help as a method I've used previously,
I would really appreciate if you could shed light on this problem. I have
I would really appreciate any help with the following problem: I need to be
Ok I give up and would really appreciate it if you guys could cast
I'm very new to C++ and would really appreciate any and all help. I
So I'm still a fledgling programmer and I would really appreciate it if someone
I would really appreciate some help with my problem: I have 2 MySQL tables,
Once again I need some help. I'm working with a table that contains 3
I would really appreciate it if someone can validate the many-to-many and Many-to-one relations

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.