Home > Mobile >  A Database Error Occurred Error Number: 1096 No tables used SELECT *
A Database Error Occurred Error Number: 1096 No tables used SELECT *

Time:08-10

I am getting this Error

1096 No tables used SELECT *

my code is below not getting what is wrong in that.

public function getH20StockDevelopmentGraph($recStart,$recEnd){
    $sql = "SELECT v.DATE,
                    (SELECT SUM(b.QTY)
                    FROM tbl_ax_transaction b
                    WHERE DATE(b.DATEPHYSICAL) <= v.DATE
                        AND b.ITEMID = '166647'
                        AND ((b.RECEIPT <> 'Ordered') OR (b.RECEIPT IS NULL))) STOCK_ON_HAND
            FROM (SELECT ADDDATE('1970-01-01',
                                    T4.I * 10000   T3.I * 1000   T2.I * 100   T1.I * 10   T0.I) DATE
                    FROM (SELECT 0 I UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) T0,
                            (SELECT 0 I UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) T1,
                            (SELECT 0 I UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) T2,
                            (SELECT 0 I UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) T3,
                            (SELECT 0 I UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) T4) V
            WHERE DATE BETWEEN '$recStart' AND '$recEnd'";
    $this->db->query($sql);
    return $this->db->get()->result();
}

Thank you for your support.

CodePudding user response:

No need using get()

$this->db->query($sql);
return $this->db->result();
  • Related