Friday, 29 April 2016

php - mysqli Query throws a notice : Trying to get property of non-objec

$startTime = "09:30";

$sql_monday = "SET @VALUE = '".$startTime."';
SELECT * FROM schedule_orders
WHERE @VALUE >= DATE_FORMAT(start_time, '%H:%i')
AND @VALUE <= DATE_FORMAT(end_time, '%H:%i');";


$result = $conn->query($sql_monday);
if ($result->num_rows > 0) {
// output data of each row
while($All_monday_Orders = $result->fetch_assoc()) {
$All_monday_Orders['id'];
}
}


Above is my Code which throws me a Notice





Notice: Trying to get property of non-object in on line if
($result->num_rows > 0)




if i echo this query and run in phpMyadmin , it showing results.



am i doing anything wrong here in this query ?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...