Como enviar datos de un console.log de javascript a la base de datos [closed]

soy novato, quiero enviar los datos capturados en un console.log de JavaScript a una base de datos MySql.

Tengo un console.log que me muestra en consola la altitud y longitud de una localizacion. Me gastaría capturar esos datos y enviarlos a una base de datos.

Este es el código que llevo por el momento y no se como hacer el siguiente paso.

    enableHighAccuracy: true,
    timeout: 6000,
    maximumAge: 0
  };
  
  navigator.geolocation.getCurrentPosition( success, error, options );
  
  function success(position) {
    var coordenadas = position.coords;
  
    console.log('Tu posición actual es:');
    console.log('Latitud : ' + coordenadas.latitude);
    console.log('Longitud: ' + coordenadas.longitude);
    console.log('Más o menos ' + coordenadas.accuracy + ' metros.');
  };
  
  function error(error) {
    console.warn('ERROR(' + error.code + '): ' + error.message);
  };```


(Tambien tengo la conexión a la base de datos).

How i can convert json to Vmess ( v2ray) in php?

I want encode json code to vmess encryption,how i can encode json to like this code?

example code of vmess encryption:

vmess://eyJhZGQiOiIxMzcuMTg0LjQ3LjgyIiwiYWlkIjoiMCIsImhvc3QiOiIiLCJpZCI6ImE3MjA3ZmE3LTE3MTktNGFkNC04ZmY3LTM4ZmYyZTBhNjlkNSIsIm5ldCI6IndzIiwicGF0aCI6Ii90ZWxlZ3JhbS1pZC1wcml2YXRldnBucyIsInBvcnQiOiI4MCIsInBzIjoiQFNlemFyX1NlYyIsInNjeSI6ImF1dG8iLCJzbmkiOiIiLCJ0bHMiOiIiLCJ0eXBlIjoiIiwidiI6IjIifQ==

php add “hide” condition to an if statement

So I have this code that adds a custom field to my products in woocommerce:

add_action( 'woocommerce_single_product_summary', 'shoptimizer_custom_author_field', 3 );
function shoptimizer_custom_author_field() { ?>
<?php if(get_field('author')) { ?>
<div class="cg-author"><?php the_field('author'); ?></div>
<?php }
}

Now I would want to add a condition to the if-statement that says “if field is not empty, hide product title”.

The class for the product page product title seems to be “product_title”.

Will be fascinating how this will look like once It’s added into this piece of code above. I think it’s not a big deal, but my comprehension ends with HTML and CSS sadly.

With kind regards and thanks for your time and your reply

Chris

I’ve connected well a form to my database but it’s not working [closed]

I’ve been trying to find the mistake here for a while, but i really can’t see it. I have a register form (with post method) and i want to submit that info to my database in mysql (phpmyadmin). I’ve made the conexion to the data base and it should work, but it isn’t.

Can anyone see the mistake? Everithing is running in my localhost.

God bless you!

form code:

 <form action="php/registro_usuario_be.php" method="POST" class="formulario_register">
                    <h2>Registrarse</h2>
                    <input type="text" name="nombre"  placeholder="nombre completo "/>
                    <input type="text" name="email" placeholder="correo electrónico">
                    <input type="text" name="usuario" placeholder="usuario">
                    <input type="password" name="password" placeholder="contraseña">
                    <button>Registrarse</button>

Conexion php code:

 <?php
$conexion = mysqli_connect("localhost", "root", "", "metapass");
?>

the other php code:

 <?php
  include 'conexion_be.php';
    $nombre = $_POST['nombre'];
    $email = $_POST['email'];
    $usuario = $_POST('usuario');
    $password = $_POST('password');
    $query = "INSERT INTO users(nombre, email, usuario, password) 
                VALUES('$nombre', '$email', '$usuario', '$password')";
    $ejecutar = mysqli_query($conexion, $query);
?>

phpmyadmin screenshot:
phpmyadmin screenshot

SQL error when i want comparate values of two query SQL

The idea is that I would like to gather several table values ​​in a column named “entrcod”, and then have them compared to another query I am trying in my join query.

AND if a value exists in the first request and in the second it sends me the duplicate

CODE WITHOUT ERROR BUT DONT HAVE ALL VALUES I WANT

         SELECT entrcod FROM marchelot WHERE marcod = 494128
         AND entrcod IN
         
         (SELECT entrcod FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
          SELECT betcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
          SELECT buccod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
           SELECT ouvrcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
           SELECT oeuvcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001')

CODE WITH INFORMATION I WANT , BUT WITH ERROR

         SELECT entrcod FROM marchelot WHERE marcod = 494128
           UNION
             select buccod as entrcod from marchebuc where marcod = 494128 
            UNION
             select ouvrcod as entrcod from marcheouvrage where marcod = 494128 
           UNION
           select oeuvcod as entrcod  from marcheoeuvre where marcod = 494128          
          
         AND entrcod IN
         
         (SELECT entrcod FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
          SELECT betcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
          SELECT buccod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
           SELECT ouvrcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
           SELECT oeuvcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'

)

Requête SQL : Documentation

SELECT entrcod FROM marchelot WHERE marcod = 494128
UNION
select buccod as entrcod from marchebuc where marcod = 494128
UNION
select ouvrcod as entrcod from marcheouvrage where marcod = 494128
UNION
select oeuvcod as entrcod from marcheoeuvre where marcod = 494128

         AND entrcod IN
         
         (SELECT entrcod FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
          SELECT betcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
          SELECT buccod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
          
          UNION
          
           SELECT ouvrcod
          FROM prospectuserclient
          WHERE procod = 20347 AND usercod = '001'
        [...]

THE RROR

MySQL a répondu : Documentation

#1054 – Champ ‘entrcod’ inconnu dans IN/ALL/ANY subquery

Url cloaking does not work for particular link

I use the following code to cloak my affiliate links to make them more appealing:

<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name=“robots” content=“noindex,nofollow”>
  </head>
  <body onload="document.location='url';">
  </body>
</html>

It works very well for the most part, but certain links do not work and for some reason redirects users to the image use for the product in the table.

The tracking link which does not work looks like this https://www.doesnotwork.com/?a_aid=id12

I’m not quite sure what to try.

How to get value display from dynamic field

I want to create a form with dynamic fields. I want to display the data that has been inputted in the dynamic field into the review page. So before the user submits the form, they see a review of the data that has been inputted first. But I’m stuck to get value from dynamic field. Please help.

This html code

<form method=POST action="aksi.php" enctype="multipart/form-data" id="wrapped">
    <div id="middle-wizard">
        <!-- /step-->
        <div class="step">
            <h3 class="main_question"><strong>1/2</strong>Input</h3>
            <div class="form-group">
                <div class="table-responsive">
                    <table class="table table-bordered" id="dynamic_field">
                        <tr>
                            <td><input type="text" name="student_name" class="form-control required" onchange="getVals(this, 'student_name');"></td>
                            <td><button type="button" name="add" id="add" class="btn btn-success">Add more</button></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <!-- /step-->

        <div class="submit step">
            <h3 class="main_question"><strong>2/2</strong>Summary</h3>
            <div class="summary">
                <ul>
                    <li>
                        <ul>
                            <li><label>Student Name</label>: <span id="student_name"></span></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <!-- /step-->
    </div>
    <!-- /middle-wizard -->
    <div id="bottom-wizard">
        <button type="button" name="backward" class="backward">Prev</button>
        <button type="button" name="forward" class="forward">Next</button>
        <button type="submit" name="process" class="submit">Submit</button>
    </div>
    <!-- /bottom-wizard -->
</form>

This code for dynamic field

<script>
    $(document).ready(function(){
        var i=1;
        $('#add').click(function(){
            i++;
            $('#dynamic_field').append('<tr id="row'+i+'"><td><input type="text" name="student_name[]" placeholder="Student Name" class="form-control"></td><td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove">X</button></td></tr>');
        });
        $(document).on('click', '.btn_remove', function(){
            var button_id = $(this).attr("id");
            $('#row'+button_id+'').remove();
        });
    });
</script>

this code for display

<script>
    function getVals(formControl, controlType) {
    switch (controlType) {

    case 'student_name':
    // Get the value for a input text
    var value = $(formControl).val();
    $("student_name").text(value);
    break;

    }
    }
</script>

Rule for all functions in controller laravel

i want make “rule” for all functions in my controller. Example – in my AdminController i want this function(down) work for all functions without having to write it in every new function.

if(session('Admin')) {

        $accinfo = DB::Table('MEMB_INFO')->count();
        $charinfo = DB::Table('Character')->count();


        return view('ap.home', ['accinfo' => $accinfo, 'charinfo' => $charinfo]);
    }
    else
    {
        return redirect('adminpanel/login');
    }`

strlen and mb_strlen are not good [closed]

I am trying to check the length of a string.
When I check on a string in Hebrew
These functions return me that the length of a letter in Hebrew is 2
When I add:
mb_strlen($taskdescr,’UTF-8′);
The functions return that the length of a character or capital letter in English is 0.
Does anyone have a solution?

I can’t do composer update. PHP extensions seem not to be installed

I can’t do composer update. It says extensions are not installed. When I check the PHP.ini files, I see extensions installed and enabled. I also see it by running phpinfo() . The server belongs to me CentOS v7.9.2009 STANDARD vmware. Cpanel is installed.

To enable extensions, verify that they are enabled in your .ini files:
    - /opt/cpanel/ea-php81/root/etc/php.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/01-ioncube.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-bcmath.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-calendar.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-ctype.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-curl.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-dom.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-ftp.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-gd.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-iconv.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-imap.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-intl.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-mbstring.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-mysqlnd.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-pdo.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-pgsql.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-phar.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-posix.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-simplexml.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-soap.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-sockets.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-sqlite3.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-tokenizer.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-xml.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-xmlwriter.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-xsl.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/20-zip.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/30-mysqli.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/30-pdo_mysql.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/30-pdo_pgsql.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/30-pdo_sqlite.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/30-xmlreader.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/memcached.ini
    - /opt/cpanel/ea-php81/root/etc/php.d/zzzzzzz-pecl.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

When user clicks on sql table column, display column data above

I currently have an sql table that can be filtered with a html dropdown. For my site, the sql table is used so the user can click on one of the columns and add it as an exercise. What I want to happen when the user clicks on the column, is for the box above to be filled in with what the data on the column says.

For example, if the user selected ‘Barbell Curl’, then ‘Barbell Curl’ would be displayed in the box above that says ‘Exercise’ and also the ‘Muscle’ and ‘Push/Pull’ boxes would be filled in with the corresponding details.

Can this be done?
Thanks

<?php
class DBController {
    private $host = "sql306.byetcluster.com";
    private $user = "icei_32733650";
    private $password = "ZoD473049gais";
    private $database = "icei_32733650_gym_exercises";
    private $conn;
    
        function __construct() {
        $this->conn = $this->connectDB();
    }   
    function connectDB() {
        $conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
        return $conn;
    }
        function runQuery($query) {
                $result = mysqli_query($this->conn,$query);
                while($row=mysqli_fetch_assoc($result)) {
                $resultset[] = $row;
                }       
                if(!empty($resultset))
                return $resultset;
    }
}
$db_handle = new DBController();
$Muscle_NameResult = $db_handle->runQuery("SELECT DISTINCT Muscle_Name FROM gym_exercises ORDER BY Muscle_Name ASC");
?>
<html>
<head>
      <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="./style/css-reset.css">
        <style>
            .addExercise2 { display: none; }
            .addExercise3 { display: none; }
            .addExercise4 { display: none; }
            .addExercise5 { display: none; }
            .addExercise6 { display: none; }
            .addExercise7 { display: none; }
            .addExercise8 { display: none; }
            .addExercise9 { display: none; }
            .addExercise10 { display: none; }
            .addExercise11 { display: none; }
            .addExercise12 { display: none; }
            .addExercise13 { display: none; }
            .addExercise14 { display: none; }
            .addExercise15 { display: none; }
            .addExercise16 { display: none; }
            .addExercise17 { display: none; }
            .addExercise18 { display: none; }
            .addExercise19 { display: none; }
            .addExercise20 { display: none; }
            .addExercise21 { display: none; }
            .addExercise22 { display: none; }
            .addExercise23 { display: none; }
            .addExercise24 { display: none; }
            .addExercise25 { display: none; }
            .addExercise26 { display: none; }
            .addExercise27 { display: none; }
            .addExercise28 { display: none; }
            .addExercise29 { display: none; }
            .addExercise30 { display: none; }
        </style>
    </head>

      Welcome to Wired Workout<br>
      Add your exercises<br>
      <div id="addExercise1">
        Exercise<input type="text" id="Name1"><br>
        Muscle<input type="text" id="Muscle1"><br>
        Push/Pull<input type="text" id="PP1"><br>
        Sets<input type="text" id="Sets1"><br>
        Reps<input type="text" id="Reps1"><br>
        <button onclick="addMore1()">+ Exercise</button>
      </div>
      <div id="addExercise2" class="addExercise2">
        Exercise<input type="text" id="Name2"><br>
        Muscle<input type="text" id="Muscle2"><br>
        Push/Pull<input type="text" id="PP2"><br>
        Sets<input type="text" id="Sets2"><br>
        Reps<input type="text" id="Reps2"><br>
        <button onclick="addMore2()">+ Exercise</button>
        <button onclick="hideMore1()">- Exercise</button>
      </div>
      <div id="addExercise3" class="addExercise3">
        Exercise<input type="text" id="Name3"><br>
        Muscle<input type="text" id="Muscle3"><br>
        Push/Pull<input type="text" id="PP3"><br>
        Sets<input type="text" id="Sets3"><br>
        Reps<input type="text" id="Reps3"><br>
        <button onclick="addMore3()">+ Exercise</button>
        <button onclick="hideMore2()">- Exercise</button>
      </div>
      <div id="addExercise4" class="addExercise4">
        Exercise<input type="text" id="Name4"><br>
        Muscle<input type="text" id="Muscle4"><br>
        Push/Pull<input type="text" id="PP4"><br>
        Sets<input type="text" id="Sets4"><br>
        Reps<input type="text" id="Reps4"><br>
        <button onclick="addMore4()">+ Exercise</button>
        <button onclick="hideMore3()">- Exercise</button>
      </div>
      <div id="addExercise5" class="addExercise5">
        Exercise<input type="text" id="Name5"><br>
        Muscle<input type="text" id="Muscle5"><br>
        Push/Pull<input type="text" id="PP5"><br>
        Sets<input type="text" id="Sets5"><br>
        Reps<input type="text" id="Reps5"><br>
        <button onclick="addMore5()">+ Exercise</button>
        <button onclick="hideMore4()">- Exercise</button>
      </div>
      <div id="addExercise6" class="addExercise6">
        Exercise<input type="text" id="Name6"><br>
        Muscle<input type="text" id="Muscle6"><br>
        Push/Pull<input type="text" id="PP6"><br>
        Sets<input type="text" id="Sets6"><br>
        Reps<input type="text" id="Reps6"><br>
        <button onclick="addMore6()">+ Exercise</button>
        <button onclick="hideMore5()">- Exercise</button>
      </div>
      <div id="addExercise7" class="addExercise7">
        Exercise<input type="text" id="Name7"><br>
        Muscle<input type="text" id="Muscle7"><br>
        Push/Pull<input type="text" id="PP7"><br>
        Sets<input type="text" id="Sets7"><br>
        Reps<input type="text" id="Reps7"><br>
        <button onclick="addMore7()">+ Exercise</button>
        <button onclick="hideMore6()">- Exercise</button>
      </div>
      <div id="addExercise8" class="addExercise8">
        Exercise<input type="text" id="Name8"><br>
        Muscle<input type="text" id="Muscle8"><br>
        Push/Pull<input type="text" id="PP8"><br>
        Sets<input type="text" id="Sets8"><br>
        Reps<input type="text" id="Reps8"><br>
        <button onclick="addMore8()">+ Exercise</button>
        <button onclick="hideMore7()">- Exercise</button>
      </div>
      <div id="addExercise9" class="addExercise9">
        Exercise<input type="text" id="Name9"><br>
        Muscle<input type="text" id="Muscle9"><br>
        Push/Pull<input type="text" id="PP9"><br>
        Sets<input type="text" id="Sets9"><br>
        Reps<input type="text" id="Reps9"><br>
        <button onclick="addMore9()">+ Exercise</button>
        <button onclick="hideMore8()">- Exercise</button>
      </div>
      <div id="addExercise10" class="addExercise10">
        Exercise<input type="text" id="Name10"><br>
        Muscle<input type="text" id="Muscle10"><br>
        Push/Pull<input type="text" id="PP10"><br>
        Sets<input type="text" id="Sets10"><br>
        Reps<input type="text" id="Reps10"><br>
        <button onclick="addMore10()">+ Exercise</button>
        <button onclick="hideMore9()">- Exercise</button>
      </div>
      <div id="addExercise11" class="addExercise11">
        Exercise<input type="text" id="Name11"><br>
        Muscle<input type="text" id="Muscle11"><br>
        Push/Pull<input type="text" id="PP11"><br>
        Sets<input type="text" id="Sets11"><br>
        Reps<input type="text" id="Reps11"><br>
        <button onclick="addMore11()">+ Exercise</button>
        <button onclick="hideMore10()">- Exercise</button>
      </div>
      <div id="addExercise12" class="addExercise12">
        Exercise<input type="text" id="Name12"><br>
        Muscle<input type="text" id="Muscle12"><br>
        Push/Pull<input type="text" id="PP12"><br>
        Sets<input type="text" id="Sets12"><br>
        Reps<input type="text" id="Reps12"><br>
        <button onclick="addMore12()">+ Exercise</button>
        <button onclick="hideMore11()">- Exercise</button>
      </div>
      <div id="addExercise13" class="addExercise13">
        Exercise<input type="text" id="Name13"><br>
        Muscle<input type="text" id="Muscle13"><br>
        Push/Pull<input type="text" id="PP13"><br>
        Sets<input type="text" id="Sets13"><br>
        Reps<input type="text" id="Reps13"><br>
        <button onclick="addMore13()">+ Exercise</button>
        <button onclick="hideMore12()">- Exercise</button>
      </div>
      <div id="addExercise14" class="addExercise14">
        Exercise<input type="text" id="Name14"><br>
        Muscle<input type="text" id="Muscle14"><br>
        Push/Pull<input type="text" id="PP14"><br>
        Sets<input type="text" id="Sets14"><br>
        Reps<input type="text" id="Reps14"><br>
        <button onclick="addMore14()">+ Exercise</button>
        <button onclick="hideMore13()">- Exercise</button>
      </div>
      <div id="addExercise15" class="addExercise15">
        Exercise<input type="text" id="Name15"><br>
        Muscle<input type="text" id="Muscle15"><br>
        Push/Pull<input type="text" id="PP15"><br>
        Sets<input type="text" id="Sets15"><br>
        Reps<input type="text" id="Reps15"><br>
        <button onclick="addMore15()">+ Exercise</button>
        <button onclick="hideMore14()">- Exercise</button>
      </div>
      <div id="addExercise16" class="addExercise16">
        Exercise<input type="text" id="Name16"><br>
        Muscle<input type="text" id="Muscle16"><br>
        Push/Pull<input type="text" id="PP16"><br>
        Sets<input type="text" id="Sets16"><br>
        Reps<input type="text" id="Reps16"><br>
        <button onclick="addMore16()">+ Exercise</button>
        <button onclick="hideMore15()">- Exercise</button>
      </div>
      <div id="addExercise17" class="addExercise17">
        Exercise<input type="text" id="Name17"><br>
        Muscle<input type="text" id="Muscle17"><br>
        Push/Pull<input type="text" id="PP17"><br>
        Sets<input type="text" id="Sets17"><br>
        Reps<input type="text" id="Reps17"><br>
        <button onclick="addMore17()">+ Exercise</button>
        <button onclick="hideMore16()">- Exercise</button>
      </div>
      <div id="addExercise18" class="addExercise18">
        Exercise<input type="text" id="Name18"><br>
        Muscle<input type="text" id="Muscle18"><br>
        Push/Pull<input type="text" id="PP18"><br>
        Sets<input type="text" id="Sets18"><br>
        Reps<input type="text" id="Reps18"><br>
        <button onclick="addMore18()">+ Exercise</button>
        <button onclick="hideMore17()">- Exercise</button>
      </div>
      <div id="addExercise19" class="addExercise19">
        Exercise<input type="text" id="Name19"><br>
        Muscle<input type="text" id="Muscle19"><br>
        Push/Pull<input type="text" id="PP19"><br>
        Sets<input type="text" id="Sets19"><br>
        Reps<input type="text" id="Reps19"><br>
        <button onclick="addMore19()">+ Exercise</button>
        <button onclick="hideMore18()">- Exercise</button>
      </div>
      <div id="addExercise20" class="addExercise20">
        Exercise<input type="text" id="Name20"><br>
        Muscle<input type="text" id="Muscle20"><br>
        Push/Pull<input type="text" id="PP20"><br>
        Sets<input type="text" id="Sets20"><br>
        Reps<input type="text" id="Reps20"><br>
        <button onclick="addMore20()">+ Exercise</button>
        <button onclick="hideMore19()">- Exercise</button>
      </div>
      <div id="addExercise21" class="addExercise21">
        Exercise<input type="text" id="Name21"><br>
        Muscle<input type="text" id="Muscle21"><br>
        Push/Pull<input type="text" id="PP21"><br>
        Sets<input type="text" id="Sets21"><br>
        Reps<input type="text" id="Reps21"><br>
        <button onclick="addMore21()">+ Exercise</button>
        <button onclick="hideMore20()">- Exercise</button>
      </div>
      <div id="addExercise22" class="addExercise22">
        Exercise<input type="text" id="Name22"><br>
        Muscle<input type="text" id="Muscle22"><br>
        Push/Pull<input type="text" id="PP22"><br>
        Sets<input type="text" id="Sets22"><br>
        Reps<input type="text" id="Reps22"><br>
        <button onclick="addMore22()">+ Exercise</button>
        <button onclick="hideMore21()">- Exercise</button>
      </div>
      <div id="addExercise23" class="addExercise23">
        Exercise<input type="text" id="Name23"><br>
        Muscle<input type="text" id="Muscle23"><br>
        Push/Pull<input type="text" id="PP23"><br>
        Sets<input type="text" id="Sets23"><br>
        Reps<input type="text" id="Reps23"><br>
        <button onclick="addMore23()">+ Exercise</button>
        <button onclick="hideMore22()">- Exercise</button>
      </div>
      <div id="addExercise24" class="addExercise24">
        Exercise<input type="text" id="Name24"><br>
        Muscle<input type="text" id="Muscle24"><br>
        Push/Pull<input type="text" id="PP24"><br>
        Sets<input type="text" id="Sets24"><br>
        Reps<input type="text" id="Reps24"><br>
        <button onclick="addMore24()">+ Exercise</button>
        <button onclick="hideMore23()">- Exercise</button>
      </div>
      <div id="addExercise25" class="addExercise25">
        Exercise<input type="text" id="Name25"><br>
        Muscle<input type="text" id="Muscle25"><br>
        Push/Pull<input type="text" id="PP25"><br>
        Sets<input type="text" id="Sets25"><br>
        Reps<input type="text" id="Reps25"><br>
        <button onclick="addMore25()">+ Exercise</button>
        <button onclick="hideMore24()">- Exercise</button>
      </div>
      <div id="addExercise26" class="addExercise26">
        Exercise<input type="text" id="Name26"><br>
        Muscle<input type="text" id="Muscle26"><br>
        Push/Pull<input type="text" id="PP26"><br>
        Sets<input type="text" id="Sets26"><br>
        Reps<input type="text" id="Reps26"><br>
        <button onclick="addMore26()">+ Exercise</button>
        <button onclick="hideMore25()">- Exercise</button>
      </div>
      <div id="addExercise27" class="addExercise27">
        Exercise<input type="text" id="Name27"><br>
        Muscle<input type="text" id="Muscle27"><br>
        Push/Pull<input type="text" id="PP27"><br>
        Sets<input type="text" id="Sets27"><br>
        Reps<input type="text" id="Reps27"><br>
        <button onclick="addMore27()">+ Exercise</button>
        <button onclick="hideMore26()">- Exercise</button>
      </div>
      <div id="addExercise28" class="addExercise28">
        Exercise<input type="text" id="Name28"><br>
        Muscle<input type="text" id="Muscle28"><br>
        Push/Pull<input type="text" id="PP28"><br>
        Sets<input type="text" id="Sets28"><br>
        Reps<input type="text" id="Reps28"><br>
        <button onclick="addMore28()">+ Exercise</button>
        <button onclick="hideMore27()">- Exercise</button>
      </div>
      <div id="addExercise29" class="addExercise29">
        Exercise<input type="text" id="Name29"><br>
        Muscle<input type="text" id="Muscle29"><br>
        Push/Pull<input type="text" id="PP29"><br>
        Sets<input type="text" id="Sets29"><br>
        Reps<input type="text" id="Reps29"><br>
        <button onclick="addMore29()">+ Exercise</button>
        <button onclick="hideMore28()">- Exercise</button>
      </div>
      <div id="addExercise30" class="addExercise30">
        Exercise<input type="text" id="Name30"><br>
        Muscle<input type="text" id="Muscle30"><br>
        Push/Pull<input type="text" id="PP30"><br>
        Sets<input type="text" id="Sets30"><br>
        Reps<input type="text" id="Reps30"><br>
        <button onclick="hideMore29()">- Exercise</button>
      </div>
      <span id="Meal" class="Meal">
        Exercises:&nbsp;<span id="Exercises"></span><br>
        Muscles:&nbsp;<span id="Muscles"></span><br>
        Sets:&nbsp;<span id="Sets"></span><br>
        Reps:&nbsp;<span id="Reps"></span><br>
      </span>
      <button onclick="Cookies();">Submit</button>

    <body>
      <script>
        function addMore1() { document.getElementById("addExercise2").style.display="block"; }
        function addMore2() { document.getElementById("addExercise3").style.display="block"; }
        function addMore3() { document.getElementById("addExercise4").style.display="block"; }
        function addMore4() { document.getElementById("addExercise5").style.display="block"; }
        function addMore5() { document.getElementById("addExercise6").style.display="block"; }
        function addMore6() { document.getElementById("addExercise7").style.display="block"; }
        function addMore7() { document.getElementById("addExercise8").style.display="block"; }
        function addMore8() { document.getElementById("addExercise9").style.display="block"; }
        function addMore9() { document.getElementById("addExercise10").style.display="block"; }
        function addMore10() { document.getElementById("addExercise11").style.display="block"; }
        function addMore11() { document.getElementById("addExercise12").style.display="block"; }
        function addMore12() { document.getElementById("addExercise13").style.display="block"; }
        function addMore13() { document.getElementById("addExercise14").style.display="block"; }
        function addMore14() { document.getElementById("addExercise15").style.display="block"; }
        function addMore15() { document.getElementById("addExercise16").style.display="block"; }
        function addMore16() { document.getElementById("addExercise17").style.display="block"; }
        function addMore17() { document.getElementById("addExercise18").style.display="block"; }
        function addMore18() { document.getElementById("addExercise19").style.display="block"; }
        function addMore19() { document.getElementById("addExercise20").style.display="block"; }
        function addMore20() { document.getElementById("addExercise21").style.display="block"; }
        function addMore21() { document.getElementById("addExercise22").style.display="block"; }
        function addMore22() { document.getElementById("addExercise23").style.display="block"; }
        function addMore23() { document.getElementById("addExercise24").style.display="block"; }
        function addMore24() { document.getElementById("addExercise25").style.display="block"; }
        function addMore25() { document.getElementById("addExercise26").style.display="block"; }
        function addMore26() { document.getElementById("addExercise27").style.display="block"; }
        function addMore27() { document.getElementById("addExercise28").style.display="block"; }
        function addMore28() { document.getElementById("addExercise29").style.display="block"; }
        function addMore29() { document.getElementById("addExercise30").style.display="block"; }

        function hideMore1() { document.getElementById("addExercise2").style.display="none"; }
        function hideMore2() { document.getElementById("addExercise3").style.display="none"; }
        function hideMore3() { document.getElementById("addExercise4").style.display="none"; }
        function hideMore4() { document.getElementById("addExercise5").style.display="none"; }
        function hideMore5() { document.getElementById("addExercise6").style.display="none"; }
        function hideMore6() { document.getElementById("addExercise7").style.display="none"; }
        function hideMore7() { document.getElementById("addExercise8").style.display="none"; }
        function hideMore8() { document.getElementById("addExercise9").style.display="none"; }
        function hideMore9() { document.getElementById("addExercise10").style.display="none"; }
        function hideMore10() { document.getElementById("addExercise11").style.display="none"; }
        function hideMore11() { document.getElementById("addExercise12").style.display="none"; }
        function hideMore12() { document.getElementById("addExercise13").style.display="none"; }
        function hideMore13() { document.getElementById("addExercise14").style.display="none"; }
        function hideMore14() { document.getElementById("addExercise15").style.display="none"; }
        function hideMore15() { document.getElementById("addExercise16").style.display="none"; }
        function hideMore16() { document.getElementById("addExercise17").style.display="none"; }
        function hideMore17() { document.getElementById("addExercise18").style.display="none"; }
        function hideMore18() { document.getElementById("addExercise19").style.display="none"; }
        function hideMore19() { document.getElementById("addExercise20").style.display="none"; }
        function hideMore20() { document.getElementById("addExercise21").style.display="none"; }
        function hideMore21() { document.getElementById("addExercise22").style.display="none"; }
        function hideMore22() { document.getElementById("addExercise23").style.display="none"; }
        function hideMore23() { document.getElementById("addExercise24").style.display="none"; }
        function hideMore24() { document.getElementById("addExercise25").style.display="none"; }
        function hideMore25() { document.getElementById("addExercise26").style.display="none"; }
        function hideMore26() { document.getElementById("addExercise27").style.display="none"; }
        function hideMore27() { document.getElementById("addExercise28").style.display="none"; }
        function hideMore28() { document.getElementById("addExercise29").style.display="none"; }
        function hideMore29() { document.getElementById("addExercise30").style.display="none"; }
        
      </script>
    <form method="POST" name="search" action="add-exercise.php">
        <div id="demo-grid">
            <div class="search-box">
                <select id="Place" name="Muscle_Name[]" multiple="multiple">
                    <option value="0" selected="selected">Select Muscle_Name</option>
                        <?php
                        if (! empty($Muscle_NameResult)) {
                            foreach ($Muscle_NameResult as $key => $value) {
                                echo '<option value="' . $Muscle_NameResult[$key]['Muscle_Name'] . '">' . $Muscle_NameResult[$key]['Muscle_Name'] . '</option>';
                            }
                        }
                        ?>
                </select><br> <br>
                <button id="Filter">Search</button>
            </div>
            
                <?php
                if (! empty($_POST['Muscle_Name'])) {
                    ?>
                    <table cellpadding="10" cellspacing="1">

                <thead>
                    <tr>
                        <th><strong>Exercise</strong></th>
                        <th><strong>Muscle</strong></th>
                        <th><strong>Push/Pull/Static</strong></th>
                    </tr>
                </thead>
                <tbody>
                <?php
                    $query = "SELECT * from gym_exercises";
                    $i = 0;
                    $selectedOptionCount = count($_POST['Muscle_Name']);
                    $selectedOption = "";
                    while ($i < $selectedOptionCount) {
                        $selectedOption = $selectedOption . "'" . $_POST['Muscle_Name'][$i] . "'";
                        if ($i < $selectedOptionCount - 1) {
                            $selectedOption = $selectedOption . ", ";
                        }
                        
                        $i ++;
                    }
                    $query = $query . " WHERE Muscle_Name in (" . $selectedOption . ")";
                    
                    $result = $db_handle->runQuery($query);
                }
                if (! empty($result)) {
                    foreach ($result as $key => $value) {
                        ?>
                <tr>
                        <td><div class="col" id="user_data_1"><?php echo $result[$key]['Exercise_Name']; ?></div></td>
                        <td><div class="col" id="user_data_2"><?php echo $result[$key]['Muscle_Name']; ?> </div></td>
                        <td><div class="col" id="user_data_3"><?php echo $result[$key]['PPS']; ?> </div></td>
                    </tr>
                <?php
                    }
                    ?>
                    
                </tbody>
            </table>
            <?php
                }
                ?>  
        </div>
    </form>
</body>
</html>

Value of array is not shown and getting no errors

What am I doing wrong here? I have a PHP array which I want to access in WordPress. Here is a sample:

Array
(
    [data] => Array
        (
            [0] => Array
                (
                    [id] => 124
                    [name] => MyName
                    [supertype] => Mso
                    [subtypes] => Array
                        (
                            [0] => Stage 2
                        )

                    [level] => 42

And I am trying to show this like so:

<?php echo ( $myvalue['0']->id); ?>

However, this does not work as it only outputs: " "

I also tried [0], but that did not work.

What am I doing wrong?

How to fix the date comparing issue in php? [duplicate]

I want to compare a date is between two given dates or not and return the result. My logic is correct but I am unable to figure out why the statement is returning even if the date is exists in between two given dates. Can any one help me please?
Please remember the dates has to be in us format. The dates values assigned to $fromDate and $toDate coming from database but I just hardcoded them here for simplicity.

class Insurance {
        
    public $fromDate = '2019-10-01';
    public $toDate ='2020-10-01'; 
    
    public function checkDate($date) {
        $date = date('m-d-Y',strtotime($date));
        $fromDate = date('m-d-Y',strtotime($this->fromDate));
        $toDate = date('m-d-Y',strtotime($this->toDate)); 
        if(($date >= $fromDate) && ($date <= $toDate)) {
            return 'Yes';
        } else {
            return 'No';
        }
    
    }
}
    
$insuranace = new Insurance(1);
    
echo $insuranace->checkDate('01-01-2020');

Hola, buen día estoy tratando de inmstalar un nuevo programa en php en mi pc y me aparece este error [closed]

C:sampphtdocschef>composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - Root composer.json requires php ^7.2.5 but your php version (8.0.6) does not satisfy that requirement.
  Problem 2
    - bacon/bacon-qr-code is locked to version 2.0.0 and an update of this package was not requested.
    - bacon/bacon-qr-code 2.0.0 requires php ^7.1 -> your php version (8.0.6) does not satisfy that requirement.
  Problem 3
    - lcobucci/jwt is locked to version 3.3.3 and an update of this package was not requested.
    - lcobucci/jwt 3.3.3 requires php ^5.6 || ^7.0 -> your php version (8.0.6) does not satisfy that requirement.
  Problem 4
    - simplesoftwareio/simple-qrcode is locked to version 3.0.0 and an update of this package was not requested.
    - simplesoftwareio/simple-qrcode 3.0.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
  Problem 5
    - tymon/jwt-auth is locked to version 1.0.2 and an update of this package was not requested.
    - tymon/jwt-auth 1.0.2 requires php ^5.5.9|^7.0 -> your php version (8.0.6) does not satisfy that requirement.
  Problem 6
    - fzaninotto/faker is locked to version v1.9.2 and an update of this package was not requested.
    - fzaninotto/faker v1.9.2 requires php ^5.3.3 || ^7.0 -> your php version (8.0.6) does not satisfy that requirement.

To enable extensions, verify that they are enabled in your .ini files:
    - C:samppphpphp.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

sort wp posts by custom date

So I gave to each of my posts a custom date field (‘data_evento’) in format: d/m/Y.

The goal: sort the post this custom date. The most recents on top.

I tried a few online methods, but I could not make any of them actually work in my wordpress code (so I am not reposting any).

I look for help, starting from the default code I got in my template now, which is:

<?php
/* Start the Loop */
while ( have_posts() ) :
    the_post();
?>
    <div class="col">
        <?php get_template_part( 'template-parts/content-home', get_post_type() ); ?>
    </div>
<?php
endwhile;
?>

Thanks in advance!