Can´t update BDD in time

Mi expertise with WP coding is basic, almost reach intermediate level.

I know there must be a way to achieve this. I am using 2 loops one inside the other, to find matching values and make an action, which must be saved in DB.

Everything is working fine, but the index of first loop is displayed (so it´s saved in DB) one pageload later than I expect.

And I can´t figure out why is this happening.

Please I need a hint,I´m not asking nobody to do it for me.

Here my code were:

$user_index is index grabed from DDBB
$_user_updat is associative array also grabed from DDBB
$this->sample_sec is array with secuence that must match with index of loop ($want)
$want is the index of first loop, which I need to save in DB

if (isset($_POST[‘correcta’])) {
echo “Correcta”;
$stop = false;
for ($want=$user_index; $want < 127; $want++) {
# recorremos todas las lecciones
for ($went=0; $went < count($user_updat); $went++) {
# Comprobacion
if ($this->sample_sec[$want] == $user_updat[$went][1]) {
echo “<p>Indice: “.$want.”</p>”;
echo $user_updat[$went][0].”en caja: “.$user_updat[$went][1];

maybe_serialize(update_user_meta( get_current_user_id(),’lmsleit_user_data’,$user_updat));

$stop = true;
else{echo “Esta leccion no esta en la caja…”;break;}
if($stop == true){
//maybe_serialize(update_user_meta( get_current_user_id(),’lms_index’,$want));

if ($want == 126) {$want = 0;}


Read more here:: Can´t update BDD in time

Leave a Reply

Your email address will not be published. Required fields are marked *