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 8977015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:16:39+00:00 2026-06-15T19:16:39+00:00

The coding below works like when a user clicks submit, he get one ticket

  • 0

The coding below works like when a user clicks submit, he get one ticket (lodd) and loses five points because he bought one ticket for five points. But I miss when a user don’t get five points he can’t buy. I want that if the user doesn’t get enough points then an echo says (example):

Sorry, but you need at least five points to buy a ticket.

How can I do that? Now people only go in minus if they buy more than they have.

<?php
    session_start();

    //=============Configuring Server and Database=======
    $host        =    'localhost';
    $user        =    'root';
    $password    =    '';

    //=============Data Base Information=================
    $database    =    'login';

    $conn        =    mysql_connect($host,$user,$password) or die('Server Information is not Correct'); //Establish connection with the server
    mysql_select_db($database,$conn) or die('Database Information is not correct');

    //===============End Server Configuration============

    //=============Starting Registration Script==========


    $username    =    mysql_real_escape_string($_POST['txtusername']);

    //=============To Encrypt Password===================

    //============New Variable of Password is Now with an Encrypted Value========


    $insert = "UPDATE `users` SET `points` = (`points`-5) WHERE `username` = '".$username."'";
    mysql_query($insert);

    // Other code

    $insert = "UPDATE `users` SET `lodd` = (`lodd` +1) WHERE `username` = '".$username."'";
    mysql_query($insert);

    mysql_query($insert);

    header('location: succes.php');
?>

This is the code that give people one ticket for five points:

$insert = "UPDATE `users` SET `points` = (`points`-5) WHERE `username` = '".$username."'";
mysql_query($insert);

// Other code

$insert = "UPDATE `users` SET `lodd` = (`lodd` +1) WHERE `username` = '".$username."'";
mysql_query($insert);

mysql_query($insert);
  • 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-15T19:16:40+00:00Added an answer on June 15, 2026 at 7:16 pm

    First, mysql_* are deprecated so you should look at changing them at some point. One option is to use: MySQLi

    Back to your question, you could do this:

    $insert = "UPDATE `users` SET `points` = (`points`-5) WHERE `username` = '".$username."' and points > 5";
    mysql_query($insert);
    if (mysql_affected_rows() > 0)
    {
        // other codes
    
        $insert = "UPDATE `users` SET `lodd` = (`lodd` +1) WHERE `username` = '".$username."'";
        mysql_query($insert); 
    }else{
        echo "You don't have enough points";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know to set Typeface from coding like below. type1=Typeface.createFromAsset(getAssets(),fonts/helveticaneueLtstd-bd.otf); text.setTpeface(type1); But it is
Code below works but what doesn't work properly is delaying process because I don't
Synopsis: I need to display a table like the one below: Necessities: Semantic HTML
The coding below seperates the $state data, I need help putting the var_dump info
I have the below coding, i am make sure that if condition is TRUE,
My friend done this below coding for custom control <a href=javascript:__doPostBack('id','msg');>click</a> now i want
I can't help but thing there is a better way of coding the below
The question I would like to ask is if the Javascript snippet below is
Some please help me with coding the below piece! So at the moment I
The below code works fine on IE7 but not in Safari(5.0.5). If possible, I

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.