javascript - Outputted results from query outputting, but not allowing some of the results to be selected -
i have following code supposed shuffle results database if user in group 3, 4 or 5. query outputting results fine, when click button shuffle results, results display group 3. believe issue in js, i'm not sure or why shuffling group 3 results when query selecting users group 3,4 , 5 , output shows that.
lets say:
bob group 3
joe group 4.
bill group 5
the way page looks this.
users need shuffled... -bob -joe -bill
button - shuffle
when click on shuffle button. bob shows up.
what wrong in code this?
$query = mysqli_query($con, "select * users `group` in (3, 4 ,5)"); echo 'users given draft order: <br>'; $array = array(); while ($row = mysqli_fetch_assoc($query)) { $array[] = $row; echo $row['firstname'] . ' ' . $row['lastname'] . '<br>'; } ?> <form method="post" name="form"> <input type="submit" value="create draft order" name="shuffle"> </form> shuffled results: <br> <div class="main-bag"> <div class="shuffle_results" id="results"></div> </div> <form method="post"> <input type="submit" value="finalize draft order" name="insert"> var displayresults = function(data){ var = 0; var lineheight = 24; var time = 3000; var interval = setinterval(function(){ if( <= data.length){ console.log( data[i] ); $('#results').append('<div class="result">' + //'<div class="shuffle_results">' + data[i].firstname + ' ' + data[i].lastname + '</div>' + '<div class="shuffle_results">' + data[i].drafted_order + ' '+ data[i].firstname + ' ' + data[i].lastname + '</div>' + '<input type="hidden" name="count[]" value="' + data[i].drafted_order + '">' + '<input type="hidden" name="firstname[]" value="' + data[i].firstname + '">' + '<input type="hidden" name="lastname[]" value="' + data[i].lastname + '">' + '<input type="hidden" name="id[]" value="' + data[i].id + '">' + '<input type="hidden" name="username[]" value="' + data[i].username + '">' + '<input type="hidden" name="email[]" value="' + data[i].email + '">' + '</div>'); var $this = $('.shuffle_results:last'); $this.show().animate({ 'left': 0 + 'px', 'bottom': + '0px' //$(document).height() - (lineheight * data.length) }, { duration: time }); i++; } else { clearinterval(interval); } }, 3000); };
Comments
Post a Comment