View Single Post
  #5  
Old 04-23-2017, 06:31 PM
p810 p810 is offline
Member
 
Join Date: Apr 2017
Posts: 6
Gender: Unknown/Other
Credits: 966
p810 is on a distinguished road
Default

Here is a simplified version.

PHP Code:
if ($mysidia->input->post('buy')) {
    
$chosenOption = (int) $mysidia->input->post('myList');

    for (
$i 1$i $chosenOption$i++) {
        
$mysidia->db->insert('raffle_tickets', array(
            
'owner' => $mysidia->user->username
        
));
    }

It casts the type of $chosenOption to an integer. Like explained above the for loop just iterates over the block of code until the condition is false; i.e. $i (the counter) is greater than $chosenOption.
Reply With Quote