Show / hide php mysql results with loader

207
January 13, 2018, at 07:59 AM

i have mysql database results, i want to show 3 rows and then hide rest. so when the user clicks to load more data then to appear all rows. the problem is when i click show more, then only one more row appears, any help?

<?php
$query_brands = mysql_query("SELECT distinct pd_filter1 from tbl_brands2 WHERE pd_code in (select pd_code from tbl_product where cat_id='2')") or die(mysql_error());
$count_brands  = mysql_num_rows($query_brands);
  if($count_brands > 0) {
  while($fetch_brands = mysql_fetch_array($query_brands)) {
    $record_brands[] = $fetch_brands;
  }
  }
$i_brands=0;
foreach($record_brands as $records_brands) {                                
?>
<table border="1" width="215" style="border-collapse: collapse;  border-spacing: 0;" bgcolor="#eeeff0">
  <tr>
    <td>
<?php
      $i_brands = $i_brands + 1;
      if ($i_brands > 3)
        {
?>
        <div id="myDIV_Filter1_1" style="display:none";>
<?php
        }
      }
?>
    <div id="myDIV_Filter1_2">
      <span class="class22">
        <a href="#" onclick="myFunction();return false;">show more...</a>
      </span>
    </div>  
    <div id="myDIV_Filter1_3" style="display:none";>
      <span class="class22">
        <a href="#" onclick="myFunction();return false;">show less...</a>
      </span>
    </div>  
    </td>
  </tr>
</table>

JavaScript

function myFunction() {
    var x_filter1_1 = document.getElementById("myDIV_Filter1_1");
    var x_filter1_2 = document.getElementById("myDIV_Filter1_2");
    var x_filter1_3 = document.getElementById("myDIV_Filter1_3");
    if (x_filter1_1.style.display === "none") {
        x_filter1_1.style.display = "block";
        x_filter1_2.style.display = "none";
        x_filter1_3.style.display = "block";
    } else {
        x_filter1_1.style.display = "none";
        x_filter1_2.style.display = "block";
        x_filter1_3.style.display = "none";
    }
}
Rent Charter Buses Company
READ ALSO
php transform string 1|*|3|*|150 to another format [&ldquo;1&rdquo;,&ldquo;3&rdquo;,&ldquo;150&rdquo;]

php transform string 1|*|3|*|150 to another format [“1”,“3”,“150”]

I have a php code to read multiselect values from databasethe value maybe a single string like 1 or 2 or

170
Laravel 5.4 Queue Email

Laravel 5.4 Queue Email

I'm trying to use Laravel Queues for sending emails using the database driver, I have already configured it, run the migration for the "jobs" table and when I run this:

236
Symfony 4: doctrine in command

Symfony 4: doctrine in command

I am using symfony 4 and I want to access a repository for an entity if I am in the Command classThere is not a function getDoctrine or something

442
why the while loop runs once?

why the while loop runs once?

the following code is only running once , while the number of times it should run is 4 , any help ?

223