AbanteCart Development > Customization help

Getting MySql Error (v1.2.13)

(1/2) > >>

rigrax:
WHAT I'M SEEING:

There has been a critical error processing your request
SQL Error:   Error No: 0
SQL: in /home/xxxxx/public_html/xxxx/xxxx/core/database/amysqli.php on line 114
(I have removed folder names for secuity's sake)

MY PURPOSE:
I'm testing the ability to add a simple db query on the   storefront/view/default/template/common/success.tpl    page and to return two lines of results to the page for the user.   This is in preparation for adding code for other backend actions.

WHAT I DID:
I inserted the query in the success.tpl file, based on syntax found in storefront/model/checkout/order.php    (line 152).

QUERY I ADDED IS IN RED:
[LINE 8]   <section class="mb40">
<h4 class="hidden">&nbsp;</h4>
   <p><?php echo $text_message; ?></p>
   <?php $query = $this->db->query("SELECT MAX(order_id) AS order_id FROM `".$this->db->table("orders")."`");
            $result = $this->db->query($sql);
            $row = $result->row;
            echo $row['order_id'];
            echo $row['firstname'];
        ?>
   <a href="<?php echo $continue; ?>" class="btn btn-default mr10" title="<?php echo $continue_button->text ?>">
       <i class="fa fa-arrow-right"></i>
       <?php echo $continue_button->text ?>
   </a>
</section>

What am I missing? The error shown isn't explicit enough to hint at the problem.
Thank you in advance for help.
RIGRAX

Basara:
Hello.

I dont think that .tpl file is right place for SQL query.
SQL should be in the model

rigrax:
Yes, I know; but this is just testing. Do you have any tip for me?
Thanks.

rigrax:
I will be happy to add my code in the storefront model      orders.php
So my original question is now altered:  What are the steps I must take, after getting the data I want, to insert the data into a DIFFERENT database on the same server?

Where can I securely add the required login credentials/db connection code for the receiving db?
Thanks!

abolabo:
 $query = $this->db->query("SELECT MAX(order_id) AS order_id FROM `".$this->db->table("orders")."`");
            $result = $this->db->query($sql);

why you do $this->db->query() twice?

Navigation

[0] Message Index

[#] Next page

Go to full version
Powered by SMFPacks Social Login Mod