Jump to content

Spring

Members
  • Posts

    224
  • Joined

  • Last visited

Posts posted by Spring

  1. Depends on what you mean by "once a day".  If I click today (Monday) at 11:59PM, can I click again tomorrow (Tuesday) at 12:01AM even though it's been only 2 minutes?

     

    Just 24 hours time. All I want is a 24 hours between clicks on the submit button for each person.

  2. Perhaps updating the database right away, and then caching the results for the user for a certain period of time would be a solution.

     

    Otherwise you'd probably have to store everything in a temporary directory, and then set up a cron job to scan the folder and make the DB updates.

     

    I have the same question, but I was pretty  sure you could some how use a php time function to do this..or maybe javascript? Is going through all that trouble the only way?

  3. Hi, I have a field called experience in mysql and I want to add +7 to said field, is it possible using UPDATE or insert? If so, what's the syntax?

     

    Here's what I have that doesn't work, it sets experience to 7, but won't add another 7 when clicked again.

     

     if(isset($_POST['submit'])){
        $query = "UPDATE account_info SET experience = +7 WHERE username = $name"; 
        $result = mysql_query($query) or die(mysql_error());
    }

     

     

    don't ask for the whole script, because you won't need it to answer that o.0

  4. <?php
    include "database.php";
    session_start();
    
    $name = $_session['outname'];
    function output_wins($name){
      $sql = "SELECT * FROM account_info WHERE username = '$name'";
      $result = mysql_query($sql) or die(mysql_error());
      $wins = mysql_fetch_array($result);
      return $wins['win'];
    }
    
    
    
    ?>

  5. change the mysql_query line to this:

     

    $result = mysql_query($sql) or die(mysql_error());
    

    I did and this is the error:

    mysql_fetch_array(): supplied argument is not a valid MySQL result resource

     

  6. $sql = 'SELECT * FROM account_info WHERE username ="'.$name.'"';
    $result = mysql_query($sql) . mysql_error();
    $row = mysql_fetch_row($result);

     

    I get

     

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource

     

    I'm trying to output the row "wins" for a certain user.

  7. How do I got about outputing one row that can only hold one value? Any reason why the function below doesn't work?

     

    <?php
    include "database.php";
    session_start();
    $name = $_session['outname'];
    
    function output_wins(){
    $sql = 'SELECT * FROM account_info WHERE username ="' . $name .'"';
    $result = mysql_query($sql);
    $wins = mysql_fetch_array($result);
    echo $wins['win'];
    }
    
    
    
    output_wins();
    
    ?>

     

    Is there an easier way I can output this one row?

  8. Respect my authority.

     

    Jokes. Please don't hurt me.

     

    I'd like to give thanks to all of the people who have helped me recently on the problems I have been having with PHP. Sometimes, when I get a question answered, I'll be so excited to try out the solution myself, I forget to give thanks to that person who spent time out of his/her day to help me.

     

    I think the website is great and hope that it will be here for the long run. I would have probably given up no php without this site, hell, I predict that soon half of this websites posts will belong to me asking for help.  :D

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