Problem JS script with php code

Discuss coding issues, and scripts related to PHP and MySQL.
User avatar
Posts: 267
Location: Holland Rotterdam

Problem JS script with php code

I try to add this script to build a energy-low-mode dark-mode
But It only succeed with one item but I would like to have it with all items 6 rows

<?php echo $row['post_id']?>

elem5<?php echo $row['post_id']?> = document.querySelector(".img4<?php echo $row['post_id']?>");

Code: Select all

        function setBg2() { 
            elem = document.querySelector(".column"); 
            elem1 = document.querySelector(".column1"); 
            elem2 = document.querySelector(".column2");
 elem4 = document.querySelector(".venster");

 elem5<?php echo  $row['post_id']?> = document.querySelector(".img4<?php echo  $row['post_id']?>");

   = "black"; = "black"; = "black"; = "black"; 
  elem5<?php echo  $row['post_id']?>.style.background = "black"; = "gray"; = "gray"; = "gray"; = "gray"; 

  <td bgcolor=#ffffff>
  <th bgcolor="#FFFFFF">
   <span style="cursor: crosshair">
    <a href="#" onmouseover="setBg0()"> <t style="color: #ffffff; background-color: #ffffff">w</t></a>
    <a href="#" onmouseover="setBg1()"><t style="color: #a6a6a6; background-color: #a6a6a6">g</t></a>
    <a href="#" onmouseover="setBg2()"><t style="color: #000000; background-color: #000000">d</t></a>
& I place it in this script

Code: Select all

    // Include the database configuration file
    include 'dbConfig.php';
    // Get records from the database
    $query = $db->query("SELECT *, SUBSTRING(`post_text`, 1, 150)   AS post_text  FROM w3_post where not privacy='hide' ORDER BY post_id DESC LIMIT 6");

    if($query->num_rows > 0){ 
        while($row = $query->fetch_assoc()){ 

include 'badwords-busy.php';
   $postID = $row['post_id'];

    <?php } ?>
    <div class="show_more_main" id="show_more_main<?php echo $postID; ?>">
        <span id="<?php echo $postID; ?>" class="show_more" title="Load more posts">Show more</span>
        <span class="loding" style="display: none;"><span class="loding_txt">Loading...</span></span>
    <?php } ?>

I do not understand the script because the code is not complete.
You not have html code with classes used in the setBg2() function; and it is a mix of js-php code that cannot be tested.

I apologize the script is a bit too big, and it's only 1 item I don't get fixed but I'll leave it that way .... Thanks for the feedback

Similar Topics