Jump to content

Jiraiya

Members
  • Posts

    206
  • Joined

  • Last visited

    Never

Posts posted by Jiraiya

  1. I need help creating this php updating form its supposed to update a pic url with a new one that is submitted by a html form i what i have is shown below

     

     

    <form>
    Picture URL:
    <input type="text" pic="pic" />
    <input type="submit" value="Submit" />
    </form> 
    <br />
    
    </form> 
    <?php
    
    $username = $_COOKIE['ID_my_site']; 
    mysql_connect("mysql", "username", "password") or die(mysql_error());
    mysql_select_db("members") or die(mysql_error());
    
    
    $sql = mysql_query("UPDATE users SET `pic` = name") or die(mysql_error());
    
    
    
    ?>

  2. I need to know how to create a math system that pulls variables from a table that are selected

    im trying to create a program to do math with variables that are choosen by the user

    for example if i were to use a fighitng game it would be like

    Player 1

    options

    Health (variable) is 25       

    punch(variable) is 10           

    kick 5

    i need to make it so that the user picks the variable from a list and then the the variable that they pick is put into a equation with the only thing changing in the equation is the variable choose by the user

     

     

     

     

  3. here is the code

    it displays a random number but doesn't update the variable

     

     

    $username = $_COOKIE['ID_my_site']; 
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
    
    echo (rand(1,10));
    $var = rand(1, 10);
    $sql = "SELECT * FROM users WHERE number = '$var'";
    mysql_query($sql) or die(mysql_error());
    
    
    
    ?>

  4. i was wondering how would i make it so a random word from a list would be put into a database table when they sign up for my site? so in other words i want to have a random word to be set as one of the users variables when they sign up and i want to have it so that each word has a preset percentage of that word being picked for the database.

  5.  

     

    ok it now displays "You have bought one health potion."

    but its not updating the database

    Code: [select]

    $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");

    $row = mysql_fetch_array($sql);

    if ($row['gold'] >= 100) {

    $sql = ("UPDATE users SET `gold` = `gold`-100, `potions` = `potions`+ 1  WHERE `username` = '$username'") or die(mysql_error());

    echo "<center>You have bought one health potion.</center>";

    }else{

    echo "<center>You don't have enough gold. Come back when you getmore.</center>";

    }

     

  6. ok it now displays "You have bought one health potion."

    but its not updating the database

    $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
    $row = mysql_fetch_array($sql);
    if ($row['gold'] >= 100) {
    $sql = ("UPDATE users SET `gold` = `gold`-100, `potions` = `potions`+ 1  WHERE `username` = '$username'") or die(mysql_error());
    echo "<center>You have bought one health potion.</center>";
    }else{
    echo "<center>You don't have enough gold. Come back when you getmore.</center>";
    }

×
×
  • 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.