Jump to content

Masna

Staff Alumni
  • Posts

    288
  • Joined

  • Last visited

Posts posted by Masna

  1. Try this instead:

     

    if (isset($_POST['submit']) && ($_POST['submit'] == "Stop")) {
    for ($i=0; $i < 2; $i++) {
    
    	if (isset($_SESSION['answer'.$i])) {
    	//do nothing
    	} else {
    	$_SESSION['answer'.$i] = "wrong";	
    	}
    }
    
    redirect_to($_SESSION['currentpage'] . "?quizid=" . $_SESSION['quizid']);
    
    } else { 
    // do nothing
    }

  2. $get_rows = mysql_query("SELECT * FROM `list_of_things`");
    
    $i = 0;
    while($row = mysql_fetch_assoc($get_rows)){
         if($i % 2 == 0){
              $bg_color = 'light-grey';
         } else {
              $bg_color = 'grey';
         }
    
         //echo information you want displayed
    
         $i++;
    }

  3. Neither suggestion has worked, but I'm not sure what I'm doing either!

     

    I tested the query in phpmyadmin just to be sure it works, and it was a success. It's obviously got to be something with my WHERE clause.

     

    Where is this query being executed? In what file are you trying to execute it? It should be in previews.php. Is that where it is?

  4. $file_string = '<div style="padding-bottom:5px;"><a target="_parent" title="'.$row['post_subject'].'" href="' . $url . '">' . $subject . '</a> - ' . $row['username'] . ' : ' . date("D m/d/y, h:ia",$row['post_time']) . ' </div>';
    file_put_contents("collective_file.txt", $file_string, FILE_APPEND);

  5. ok. Iv got this problem. that is extremely idiotic and irritating. But could someone please tell me how to make a board. like as in on the site. or is it a category. i dont remeber what to do.

     

    Ok first you have to buy it. Then you put it on (don't forget the switch!) and call the one you need. And after that you use what you know to apply it correctly and it works.

     

    And you're done! It's simple!

  6. I tried to echo get winners and it didnt echo anything... hmm

     

    Lol, well of course not. It's a result resource link. You have to use mysql_fetch_assoc() to get a usable array from the SELECT query.

     

    $number_of_winners = 1;
    $get_winners = mysql_query("SELECT * FROM `members` WHERE `lottery`='1' ORDER BY RAND() LIMIT ".$number_of_winners);
    
    $winner = mysql_fetch_assoc($get_winners);
    
    //$winner now stores an array of data for one particular (randomly chosen) member
    //Assuming that members have a username...
    echo $winner['username'];

  7. I suggest creating an IP Logs table (maybe called 'ip_logs'). Create it with three fields: user_id, ip_address, timestamp (stores a UNIX timestamp).

     

    Then, upon each successful login, insert a new row into the table including the user's ID, IP address, and time stamp, respectively.

     

    To grab a user's IP...

     

    $ip_address = $_SERVER['REMOTE_ADDR'];

  8. I'm going to assume you know how to add a field called "lottery" and how to set it to '1' when a user chooses to enter the lottery.

     

    For selecting random lottery winners...

     

    $number_of_winners = 10; //change this to fit your needs
    $winners = array();
    
    for($i = 0; $i < $number_of_winners; $i++){
         $get_winner = mysql_query("SELECT * FROM `members` WHERE `lottery`='1' ORDER BY RAND() LIMIT 1");
         $winners[] = mysql_fetch_assoc($get_winner);
    }
    
    //$winners now contains a multi-dimensional array of 10 winners

     

    Be sure to note that you may not actually have to query 10 winners separately, but possibly 10 winners in one query. I'm not sure exactly how ORDER BY RAND() works (whether it picks a random spot and then returns ordered rows from there or if it picks 10 rows independently and all at random). It probably randomizes each row selection. So, this may work...

     

    $number_of_winners = 10;
    $get_winners = mysql_query("SELECT * FROM `members` WHERE `lottery`='1' ORDER BY RAND() LIMIT ".$number_of_winners);
    
    //use $get_winners at your discretion

     

    But, again, I'm not sure and I'm too tired to test on my own. :)

  9. I'm not sure how to do it with DATETIME format, but you can do it very easily if you store a UNIX timestamp instead:

     

    $timestamp = {retrieve timestamp from MySQL database here};
    $timestamp += (60*60*17);

  10. Hi All,

     

    Thank much for the quick replies, I really appreciate it.

     

    Does the "$referrer = $_GET['referrer'];" statement get any referral id or does it just get the ones that are identified by a particular code. For instance if my referral code is "http://amazinghomeventures.com?ref=ahvceo", would the above statement work or would I use "$referrer = $_GET['ref'];"?

     

    You would use $referrer = $_GET['ref']; What lies in the $_GET quotes is the name of the variable in the URL.

     

    Does the statement return "referrer=username or just the username?

     

    Does it work if there is an interveining URL?  For instance if someone is referred to my site and I send them to PayPal before I try to get the referrers name, can I still get it this way?

     

    Thanks again, looking forward to your next reply!

    ahvceo

     

     

    Yes, you can still get it.

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