Jump to content

echoindia756

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Posts posted by echoindia756

  1. Hi there,

     

    I'm having a bit of trouble getting something to work. Basically, I have several fields in a table:

     

    "Item Name" and "Item Price"

     

    These values are dynamic to each user (so different items will appear depending on your username),

    I want to retrieve this information from the database row and put it into a HTML table on the users homepage on my website

     

    So for example the data would appear like this:

     

    Item Name              Item Price 

    Digital Camera            €40.00

    Underwater Camera      €50.00

     

    So I think the mysql query would be something like:

     

    mysql_query("SELECT * FROM table_name WHERE user_id = $_SESSION['user_id']");

     

    But i'm not sure how to get all the users items to display on the table, could someone help me with the PHP code please?

    I'd really appreciate it!

     

    Thanks in advance!

  2. mysql_query("UPDATE `game_planets` SET `belcredits`=`belcredits`+100 WHERE `username`='username' LIMIT 1");
    

     

    There is an example of how it would update only one record based on username being usersname

     

    though I highly suggest using an ID field and ID being a UNIQUE.

     

    Thanks! I have an ID Field in the database called id_owner and another field with the name of the planet. So would this work?

     

    mysql_query("UPDATE `game_planets` SET `belcredits`=`belcredits`+100 WHERE `name`='id_owner' LIMIT 1");

     

     

  3. Ok, for example: Let's say one of the errors is

     

    $SelectProduct = $_GET['whatever'];

     

    You would put that near the top of the page, and then wherever the error is, you just right it so that it says:

     

    $SelectProduct;

     

    i.e remove everything after the equals, except the semi-colon of course.

     

     

  4. Got this:

     

    /includes/header.php on line 48

     

    Notice: Undefined index: css in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 125

     

    Notice: Undefined index: HTTPS in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 9

     

    You'll have to make those lines so their not relying on register_globals being on.

  5. Hi there,

     

    I'm designing an online game website. I'm having a little trouble getting something to work right. You see players of the game can buy "credits", these allow them to buy things to further their rank etc and make them stronger than other players. But the problem i'm having is that when a player buys credits, it gives that player credits, but it also gives every other player in the database credits! So if one person buys 100 credits, every user in the database gets 100 credits.

    This is the code i'm using:

     

    mysql_query("UPDATE `game_planets` SET `belcredits`=`belcredits`+'100'");

     

    How would I change that code so it only updates the person's credits who actually bought them? I was thinking of something like getting the username that the user used to login, or maybe somebody can think of a better way to solve this. Thanks in advance!

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.