Query Query

Ask the community for help and support.
Post Reply
tessthepup
VIP Member
VIP Member
Posts: 252
Joined: Mon Mar 01, 2021 5:55 pm
Has thanked: 27 times
Been thanked: 8 times

Query Query

Post 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>
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Query Query

Post by raiwa »

You are doing “$db->query(“ twice.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
Post Reply