Page 1 of 1

Query Query

Posted: Mon Nov 29, 2021 8:53 pm
by tessthepup
Good evening all,

I am using CE Phoenix v1.0.8.7

I have created an xml import script which has placed all the products into a new table and I am now trying to display the products on a new admin page which works fine however I cannot for some reason get the data to fill the table.

The query works if I run it in phpmyadmin but for some reason it wont populate the table.

Please would someone have a look at the code below and advise on what I am doing wrong or if I am missing something

Code: Select all

<table id="products" data-toggle="table" data-search="true" data-pagination="true" data-pagination-pre-text="Previous" data-pagination-next-text="Next" data-show-columns="false" data-show-columns-toggle-all="false" data-show-toggle="false" data-buttons-align="left" data-buttons-class="primary">
 <?php
    echo '
    <thead class="thead-dark">
      <tr>
       <th data-sortable="true" data-field="pid">pid</th>
       <th data-field="name">name</th>
       <th data-field="var_grouped">var grouped</th>
       <th data-field="var_group">var group</th>
       <th data-field="var" data-visible="false">var</th>
       <th data-field="sku">sku</th>
      </tr>
    </thead>';

   $query = $db->query("SELECT * FROM tbl_temp_products ORDER BY pid");
     if ($result = $db->query($query)) {
  	while ($row = $result->fetch_assoc()) {
  	  $field1name = $row["pid"];
          $field2name = $row["name"];
          $field3name = $row["var_grouped"];
          $field4name = $row["var_group"];
          $field5name = $row["var"];
          $field6name = $row["sku"];
       }
     }
</table>

Re: Query Query

Posted: Mon Nov 29, 2021 9:04 pm
by raiwa
You are doing “$db->query(“ twice.