Jump to content

estcod

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by estcod

  1. 24 minutes ago, Barand said:

    There is nothing in your form that has the name "alltree" so $_POST['alltree'] will not exist. (Turn php error reporting on. It would have told you that)

    The line "$oak = $_POST['oak']" is a waste of space.

    the column identifiers (puud, sire1) should not have the $s.

    mysqli_query() requires 2 parameters (see manual link provided)

    Thank you for answer..

     

    <?php
               if( isset($_POST['oak']) ){
        $oak= $_POST['oak'];
        $sql = "UPDATE users SET oak=$oak+1";
                echo "You cut a tree down!";
    }
    
               
    ?>
                <form action="demo.php" method="POST">
                <input type="submit" name="oak" value="Cut a tree!">
                </form>

    So, now i'm thinking.. ..move right direction with this code?

    Code not show errors or smth but now i stand little problem, cut a tree and page refesh show me the ECHO and not updated my oak amounts on sql.

  2. Hello!

    I have little problem with my code.. and my head blow up...

    Code is php

    <?php
    include 'db.php'; if( isset($_POST['oak']) ){
    $alltree = $_POST['alltree']; 
    $oak= $_POST['oak'];
    $sql = "UPDATE users SET $puud = $puud + 1, $sirel=$sirel+1"; 
    } 
    if (mysqli_query($sql)) {
     echo "'+1 Oak tree added!"; 
    } ?> 
    <form action="demo.php" method="post"> 
      <input type="submit" name="oak" value="Cut a tree!"> 
    </form>

    My vision is.. if press CUT A TREE! and page updated.. and update my oak amount at mysql data..

    So, i'm newbie but i take a little journey for study :)

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