I'm trying to fill a table with a query, but it gives me the error:
Notice: Trying to get property of non-object in [DIRECTORY] on line [LINENUMBER]
(The line points to every instance of $curs)
Heres the how I call the data from the database:
$MyQuery = " //the query that is needed for the data to fill the table
select ndate, code, channel, credit, countedstock, systemstock, discrepancy, nominal
from mydatabase.stockdiscrepancy
where to_date(ndate,'YYYY-MM-DD') >= to_date('".$from."','YYYY-MM-DD')
and to_date(ndate,'YYYY-MM-DD') <= to_date('".$to."','YYYY-MM-DD')
";
$curs=$conn->Execute($MyQuery); //parsing the database with the query
So then I tried to do it with a different table to check if its the other codes that are wrong or just the sql query.
Something like this:
select ndate, dealer, location, price
from mydatabase.regionalsales
where to_date(ndate,'YYYY-MM-DD') >= to_date('".$from."','YYYY-MM-DD')
and to_date(ndate,'YYYY-MM-DD') <= to_date('".$to."','YYYY-MM-DD')
The site works, the table is filled with the result from the query perfectly.
Then I began to doubt whether its my table that is the problem. But then, I have no idea what is wrong with my table. And so I came here. Heres something about my table, hope this can help:
Is there something wrong with this table? I have checked with several tables and it works, but not this one. Help please, thanks in advance.