I have created a datatable which I am populating using data from an MYSQL database.
In order to run jQuery commands, I need to give the elements an id or class
but get an error when I add this into the PHP code.
Code I am using:
<?php
    $host_name = 'xxx.hosting-data.io';
    $database = 'xxx';
    $user_name = 'xxx';
    $password = 'xxx';
    $conn = mysqli_connect($host_name, $user_name, $password, $database);
    // Check connection
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
    $sql = "SELECT * FROM `table`";
    $query = mysqli_query($conn, $sql);
    if (mysqli_num_rows($query) > 0) {
        // output data of each row
        while($result = mysqli_fetch_assoc($query)) {
            echo "<select>
                      <option>".$result['tablerow']."</option>
                  </select>";
        }
    } else { 
        echo "0 results";
    }
    mysqli_close($conn);
?>
I want to add a class, id and name to the select and a value to the option
When I try adding the class using <select class="class"> it seems to break the site same with id and value.
Is there a better way to add such values?
 
     
     
    