I am using left join query in my php script. The code which i am using is
$tot = "SELECT
c.id,
c.name AS companyname,
m.companyid,
m.name AS naam
FROM
org c
LEFT JOIN login m ON c.id = m.companyid
";
$query = $con->query($tot);
$total = $query->num_rows;
it is giving this error to me "Notice: Trying to get property of non-object in on line $total = $query->num_rows;
"
But when i am using this line of code it is giving total num of rows easily to me. The code i am using is
$tot = "SELECT * FROM org GROUP BY id ORDER BY dateadded DESC";
$query = $con->query($tot);
$total = $query->num_rows;
echo $total;
it is working absolutely fine. SO what is the wrong thing i am doing in above code.