Jump to content

Spring

Members
  • Posts

    224
  • Joined

  • Last visited

Posts posted by Spring

  1. I get an error saying call to undefined function. Shouldn't move_uploaded_file() work?

    (I know I didn't set the size and etc, it's just a practice test) Also, my host's php version is 4.4.9 could that be a problem?

     

    <?php
    session_start();
    include "functions.php";
    include "database.php";
    
    
    if(($_POST['upload'])){
        $uploadname = $_FILES['avatar']['name'];
        $tmp_name = $_FILES['avatar']['tmp_name'];
    
      if($uploadname){
         echo "...";
        }
       
      else{
         die("Please select a file numb nuts!");
        }
    
       if($uploadname) {
            $location = "avatars/$name";
            move_uploaded_file($tmp_name,"$location");
              
            $query = mysql_query("UPDATE narutorpg SET imagelocation = '$location' WHERE username = '$name'");
            $die("Your avatar is uploaded. <a href = 'character.php'> home </a>");
    
          }
    }
    
    
    
    echo " <form action = '' method = 'POST' enctype = 'multipart/form-data'>
    File:<input type = 'file' name = 'avatar'> <input type = 'submit' name = 'upload' Value = 'upload'> 
    </form>";
    
    
    
    
    
    ?>

     

     

     

  2. 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.

  3. 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?

  4. 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

  5. <?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'];
    }
    
    
    
    ?>

  6. 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

     

  7. $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.

  8. 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?

  9. 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.